Units of Measure in F#
BCS
ao at pathlink.com
Mon Oct 6 23:53:34 PDT 2008
Reply to Denis,
> On Tue, 07 Oct 2008 00:41:29 +0400, bearophile
> <bearophileHUGS at lycos.com> wrote:
>
>> I have found this interesting old thread, I don't know how much those
>> things are true today too:
>> http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalma
>> rs.D&article_id=36939
>>
>> Beside allowing algebraic data types, that are quite useful, a
>>
>> functional-like type system allows to implement Units of Measure in a
>>
>> nice way:
>>
>> http://blogs.msdn.com/andrewkennedy/archive/2008/08/20/units-of-measu
>> re-in-f-part-one-introducing-units.aspx
>>
>> For people that don't remember what algebraic data types are:
>> http://en.wikipedia.org/wiki/Algebraic_data_type
>>
>> This power also allows to use pattern matching, absent in Python,
>> present in Haskell, Ocaml, Scala, etc.
>>
>> Bye,
>> bearophile
> Arghh! I've almost done the trick with D templates and then I got
> this: Assertion failure: 'i < parameters->dim' on line 784 in file
> 'template.c'
>
> DMD is not ready for my funky templates yet! :)
>
> I'll post my results (and a bug report) soon.
>
svn.dsource.org seems to be having problmes or I'd post a system I just
put together.
total code, WS comments: ~ 400 LOC
supports 44 different units,
support +,-,* and / as well as pow and root
More information about the Digitalmars-d
mailing list