[r6rs-discuss] [Formal] Version numbers are broken in 5.91

AndrevanTonder andre at het.brown.edu
Wed Nov 29 08:59:56 EST 2006


On Tue, 28 Nov 2006, Michael Sperber wrote:

> <version reference> -> <empty>
>                     | <version spec>     ; new
>
> <version spec> -> (<subversion reference> ...)
>                | (and <version spec> ...)
>                | (or <version spec> ...)
>                | (not <version spec> ...)
>
> This would allow saying:
>
> (or (3 (>= 2))
>    ((>= 4)))
>
> which would match:
>
> 3.2, 3.3, 3.2.1, 3.5.2, etc., 4, 4.0, 4.1.1, etc.

One might be able to simplify this further.  There is a natural ordering on 
version number sequences as a whole, and it seems natural to have the >=, <= 
express this ordering.  In other words, consider requiring the >= to be 
outside the whole version spec, and not in the subversions individually. 
With this, your example can be more readably expressed as

   (>= (3 2))

which would match (3 4), (3 2 1), (4 1) ... instead of

> (or (3 (>= 2))
>    ((>= 4)))

One could then write things like

   (and (>= (3 2))
        (<= (3 3))
        (not (3 3)))

to match (3 2), (3 2 0 1), ..., up to but not including (3 3).

By the way, with neither your proposal nor mine do I think it is possible to 
express a match on anything later than (3 2).  In other words, when (3 2) 
should not match but (3 2 0 1), (3 2 0 0 0 0 1), ... should.  Do you think this 
is important?

Cheers
Andre





More information about the r6rs-discuss mailing list