2010/9/12 Will M. Farr <wmf...@gmail.com>: > [...] > amb is a macro that chooses among the results of evaluating the expressions > it is provided, so > > (amb *someList*) > > evaluates *someList*, resulting in a list, and chooses that. You could > define a function > > (define (amb-list list) > (if (null? list) > (amb) > (amb (car list) > (amb-list (cdr list))))) > > It's also possible that the amb library provides such a function, which may > be implemented more efficiently; I don't know which amb library you're using, > so I can't help you there. > [...]
Hello, if one of the two implementations of amb that can be found on PLaneT is used, the function amb-list can probably be implemented more efficiently: * For (planet ("amb.scm" ("wmfarr" "amb.plt" 1 0))) try (define (amb-list choices) (let/cc choice-point (apply amb-thunks choice-point (map const choices)))) * For (planet ("amb.ss" ("murphy" "amb.plt" 1 1))) try (define (amb-list choices) (apply amb-call (map const choices))) Ciao, Thomas -- When C++ is your hammer, every problem looks like your thumb. _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users