Re: [racket-users] Re: how to make a cartesian supergenerator?

2018-10-21 Thread Robby Findler
If I am understanding this right, data/enumerate's list/e combinator doing a similar job. It might also be helpful. Robby On Sun, Oct 21, 2018 at 5:50 PM Jay McCarthy wrote: > I think the best strategy would be to convert the generator to a > sequence and then the sequence to a stream, then

Re: [racket-users] Re: how to make a cartesian supergenerator?

2018-10-21 Thread Jay McCarthy
I think the best strategy would be to convert the generator to a sequence and then the sequence to a stream, then write a stream cartesian product. The stream will cache the results of the generator. On Sun, Oct 21, 2018 at 4:58 PM Matthew Butterick wrote: > > I suppose just putting in a hash

[racket-users] Re: how to make a cartesian supergenerator?

2018-10-21 Thread Matthew Butterick
I suppose just putting in a hash isn't too bad. #lang racket (require racket/generator rackunit) (define/contract (make-cartesian-generator gens) ((listof generator?) . -> . generator?) (generator () (define solcache (make-hasheqv)) (let loop ([gens gens][genidx