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

Re: proposing a simpler mechanism

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/