Re: [racket] Numbers with dimensions

2013-10-26 Thread Konrad Hinsen
Laurent writes: > Examples and details here: > https://github.com/Metaxal/measures At first glance, I miss the notion of "dimension", which defines if two units are compatible, i.e. can be converted. If I understand your approach correctly (which I am not sure about), you consider each product

Re: [racket] Numbers with dimensions

2013-10-26 Thread Richard Cleis
A few years ago, my approach (which didn't get very far) was to internally maintain values in some chosen internal units; this input conversion occurred once, when variables were defined or otherwise introduced into the program. The conversion to the user-desired units then took place once via f

Re: [racket] Numbers with dimensions

2013-10-26 Thread Matthias Felleisen
The last line applies to my thoughts not yours. As someone else indicated, I think we should experiment with 'dimension' (distance, time) vs 'units' (meters vs yards, seconds vs hours). This separation injects a hierarchy that could be useful. I'd really like to see some experimentation here

Re: [racket] Numbers with dimensions

2013-10-26 Thread Laurent
So does this mean you think the representation I took is bad for some reason? If so why? On Sat, Oct 26, 2013 at 5:36 PM, Matthias Felleisen wrote: > > 1. I would hope that some generics might help here. > 2. I see a need for struct mixins here because meter isn't a refinement > per se but some

Re: [racket] Numbers with dimensions

2013-10-26 Thread Matthias Felleisen
1. I would hope that some generics might help here. 2. I see a need for struct mixins here because meter isn't a refinement per se but some 'attribute'. Then you could mixin several different units and I may have both m and m-1. Data representation not fully thought thru. -- Matthias On

Re: [racket] Numbers with dimensions

2013-10-26 Thread Laurent
How would you represents quantities like 2 kg.m^2/s^-2 with that? And how would you convert from mi/h to m/s? Anyway, I've started adding in some converters: https://github.com/Metaxal/measures/blob/master/converters.rkt Some more to come, but I may not be able to work on it for very long for now

Re: [racket] Numbers with dimensions

2013-10-26 Thread Matthias Felleisen
Wouldn't we want something like this: #lang racket (module+ test (require rackunit)) (struct distance (value) #:transparent) ;; this should be abstract (struct yard distance () #:transparent) (struct meter distance () #:transparent) ;; distance distance -> distance (module+ test (check-

Re: [racket] Numbers with dimensions

2013-10-26 Thread Laurent
Ok, so I just hacked together a small lib for handling numbers with unit symbols and exponents: Quick example: > (measure->value (m* '(18 s) '(1600 km (h -1)) '(1000 m (km -1)) '(1/3600 h (s -1 '(8000 m) You can get it with: $ raco pkg install measures or from the File

Re: [racket] Uploaded empty package?

2013-10-26 Thread Laurent
Oooh, I see... You need to press Enter on *each* line. (hem, now I remember having seen another post like this one in the near past. Sorry for the duplicate then, although that should show how this is quite confusing) Laurent On Sat, Oct 26, 2013 at 1:00 PM, Laurent wrote: > Ah, the empty pack

Re: [racket] Uploaded empty package?

2013-10-26 Thread Laurent
Ah, the empty package seems to be gone actually (added, then removed automatically?). But now how can I actually add a new package? I don't see an "upload" button, and pressing "Enter" did only partially work: Some info was modified in the background, like the package description, but the package

[racket] Uploaded empty package?

2013-10-26 Thread Laurent
Hi, This is probably a bug: I clicked on "upload", then clicked the closing cross, and this added an empty package with my name to the list. Also, now it's not as easy as it was to check our own packages. Could this feature be added back in? Thanks, Laurent Racket Users li