Re: enum-set-unfold Wolfgang Corcoran-Mathe 20 Sep 2020 23:50 UTC

On 2020-09-20 17:55 -0400, John Cowan wrote:
> > There is a serious bit of awkwardness,
> > though, in that these integers can only encode combinations of enums
> > with ordinals equal to 2^n for some n.
> I assume the intended interpretation is that iff bit n of the integer
> (according to the usual SRFI 151 bit numbering) is 1, then ordinal n is in
> the set.  In which case, getting the bitwise integer back is a fold.

That makes a lot more sense to me.  I'm still not sure whether these
conversions (integer->enum-set and enum-set->integer, probably) seem
widely useful.

> I
> still don't think it makes much sense to use an unfold to populate an
> enum-set, though, because the number of possible elements in an enum-set is
> not only finite but usually rather small.

I had the same thought, but I'd personally still be inclined to
include enum-set-unfold.  I'll try to come up with some examples
where it would be useful.

Wolfgang Corcoran-Mathe  <>

"It from bit." --John Wheeler