[racket] Units/measures library

From: Neil Toronto (neil.toronto at gmail.com)
Date: Thu Nov 17 23:24:47 EST 2011

On 11/17/2011 03:49 PM, Neil Van Dyke wrote:
> I am doing something like this with an (as yet unreleased) time library,
> and have thought of doing it for financial apps as well.

Are you setting out to beat SRFI 19, or do you have different goals?

If it's *just* time, I'd be interested to compare notes. For PLoT 5.2.1, 
I've introduced a struct whose instances contain unbounded days 
(positive and negative) and fractional seconds.

> One thing I haven't decided is whether and how to represent precision
> (or resolution) information, and what to do with that information. For a
> simple example, what is the answer to the difference "(2 days) - (3
> minutes)"? I'm wondering whether the unit of measure alone can indicate
> the precision for 99.9% of practical purposes, or we have to be able to
> support more flexible specification of precision (e.g., "(2 days) - (3
> minutes to a precision of 15 seconds)").

Ho ho, it gets worse, as I discovered when writing the date tick layout 
function for PLoT 5.2.1. What do you do with "(2 months) - (35 days)"? 
It depends on *which* two months you're talking about. Icky!

Fortunately, I didn't have to solve that particular problem. But trying 
to space ticks apparently uniformly by month was still a headache.

Neil T

Posted on the users mailing list.