2010/9/14 Stefan Busch <stefan_bus...@arcor.de>: > [...] > Your solution looked convincing to me, > but when I try e.g. > > (amb list (list 1 2 3 4)) > > it's not evaluated to the desired > > 1 2 3 4, > > but to > > 1. > [...]
Hello, I assume you meant to say (amb-list ...) instead of (amb list ...). Of course this expression evaluates to the first item in the list. This is the whole point of amb: To return the result *one* of its arguments evaluates to, but to provide the possibility of backtracking and choosing another argument. If you want a list of all possible return values of an expression, you *must* wrap it in an amb-collect. The implementation of amb provided by (planet murphy/amb:1:1/amb) will even signal an error if the dynamic context of an ambiguous expression is not enclosed by something equivalent to amb-find or amb-collect. 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