On Wed, 3 Nov 2004, Raymond Toy wrote:
> The mp code in cmucl works by copying the control stack, I think.
Plus some alien and other stuff, as far as I remember, so that would just
be perfect.
> Thomas> The question why I am asking is the following: I am just about to write
> Thomas> some logic that relies on a large body of quite efficient CMUCL code,
> Thomas> but requires a mild variant of nondeterministic choice as well.
> Thomas> Essentially, I want to express ideas like "take any combination of five
> Thomas> elements out of twelve, order does not matter here" and "take any
> Thomas> combination of three of the remaining seven there". It doesn't have to
> be
> Thomas> fast, but as the application requires some quite entangled logic, I
> would
> Thomas> be very very glad if I could shift much of that complexity to the
> Thomas> language by defining appropriate notions. And full continuation support
> Thomas> would help *a lot* there.
>
> Won't screamer help you do this kind of nondeterministic choice stuff?
> (I'm not a screamer user either, so I'm not sure if that will do what
> you want.)
I already use screamer - albeit for slightly different things. Maybe I got
a false impression, but to me it seems as if it had a lot of serious flaws
(besides some design problems). At least, I remember a session
of re-writing a lot of screamer-based code in Scheme with call/cc which
reduced code size by a factor of more than two.
There is one very ugly issue with passing around anon nondeterministic
functions - e.g. when they come in from global variables - that imposes
severe limitations (at least that's how I experienced it, maybe I missed
something essential) and makes screamer unusable for some tasks. Besides
this, the code-walker in screamer is unable to deal with LABELS local
function definitions. One can work around this by using the fixed-point
principle manually, as in:
==>
;; Nondeterministically yield all heads and rests of a list.
(screamer::defun nd-list-head+rest (li)
(let
((f-any-tail
#'(lambda (f-any-tail so-far rest)
(if (null rest)
(cons (reverse so-far) nil)
(either (cons (reverse so-far) rest)
(funcall-nondeterministic f-any-tail f-any-tail (cons (car
rest) so-far) (cdr rest)))))))
(funcall-nondeterministic f-any-tail f-any-tail nil li)))
<==
but writing lots of code in such a style sucks. Badly.
Having continuations would be much cleaner, and more useful. By the way, I
also strongly suppose that many guys (including me, by the way) who think
about using CMU CL for web related stuff would be very glad to have true
continuations.
--
regards, [EMAIL PROTECTED] (o_
Thomas Fischbacher - http://www.cip.physik.uni-muenchen.de/~tf //\
(lambda (n) ((lambda (p q r) (p p q r)) (lambda (g x y) V_/_
(if (= x 0) y (g g (- x 1) (* x y)))) n 1)) (Debian GNU)