> On Oct 21, 2018, at 3:49 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 write a stream
> cartesian product. The stream will cache the results of the generator.
Nice.
#lang racket
(require ra
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 wri
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 isn'
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 0][
The sample below tries to make a "cartesian supergenerator" that takes several
smaller generators and combines them into a larger generator that yields
cartesian combinations of the results.
This works on the first pass (when the result of g1=1). But when the result of
g1=2, the g2 generator is
5 matches
Mail list logo