> On Apr 16, 5:11 am, dillog

@gmail.com wrote:

> > On Apr 16, 4:43 am, dillog@gmail.com wrote:

> > > hi

> > > how to have a variable length of amb's?

> > > ;; This code is not working.

> > > (make-list 3 (number-between 1 3))

> > > (amb)

> > > (amb)

> > > > (1 1 1)

> > > > (2 2 2)

> > > > (3 3 3)

> > > ;; n is determined at run time

> > > (make-list n (number-between 1 3))

> > I can always use a single number to enumerate permutation of lists by

> > defining a mapping, but that's ugly and sorta defeat the purpose of

> > dynamic programming. aarrrggghhhh.

> This is where I'm stucked:

> (define (solve-gen tt)

> (define hd 2)

> (let ((n (number-between 1 tt))

> (v (number-between 1 tt))

> (l (number-between 1 tt))

> )

> (assert (= (+ n l v) tt) )

> (let ((g (number-between 1 l))

> (c (number-between 0 1))

> )

> (assert (= (+ g c) l) )

> (list n v l g c)

> ;; all dimensions are locked in

> ;; I need (make-list g (make-list n (number-between 0 hd)))

> ;; HELP!!!

> )

> )

> )

One solution is to dynamically generate code and run it in my toy