Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Scheme Programming Language

dynamic amb?


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))
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.
On Apr 16, 5:11 am, dillog@gmail.com wrote:

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!!!

      )
    )
)

On Apr 16, 5:27 am, dillog@gmail.com wrote:

One solution is to dynamically generate code and run it in my toy
interpreter, and that's ugly. Besides, my interpreter don't support
macro or call/cc.
Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc