[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: proposing a simpler mechanism

This page is part of the web mail archives of SRFI 102 from before July 7th, 2015. The new archives for SRFI 102 contain all messages, not just those from before July 7th, 2015.

For completeness, I'd like to have:

(define (arg-count->bitmask min-count max-count) ...)

where min-count is the minimum number of arguments,
and max-count is the maximum number, or -1.
(A non-infinite maximum is useful for optional arguments.)

That is easy (just a couple of shifts and masks);
a little harder are the inverse functions:

(define (bitmask->min-count mask) ...)
(define (bitmask->max-count mask) ...)

I think these are expressible using bitwise-length and
bitwise-first-bit-set, but I haven't tried to work it out.
	--Per Bothner
per@xxxxxxxxxxx   http://per.bothner.com/