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

Re: How do I turn values() into a list?




Neel Krishnaswami <neelk@brick.cswv.com> wrote in message
slrn84bbs3.7hq.neelk@brick.cswv.com">news:slrn84bbs3.7hq.neelk@brick.cswv.com...
> Hi,
>
> One of my little projects is to write a little package implementing a
> lazy evaluation package for Dylan (akin to delay/force in SICP). It's
> been easy and fun, except for one niggle: how do I capture an unknown
> number of multiple return values into a sequence?
>
> Ideally, I'd like something like this:
>
>   listify(values(5,9)) => (5, 9) // a list with two elements
>
>   listify(values(1,2,3)) => (1, 2, 3) // a list with 3 elements
>
>   listify(values()) => #() // a list with no elements
>
> but I can't figure out how. Any ideas?

not sure if Dylan supports something like this more directly (i'm not a
Dylan expert)... but general OOP would lead me to just return a growable
collection...
i'm sure Dylan has a growable collection class :)

Maxwell Sayles





References: