[racket] coding with continuations
In my 30 year career as a Schemer and Racketeer, I have found
one successful use for (upward) continuations in the world of
search, to be precise so-called "intelligent search". That's a
1970s concept from AI. You have a complex search space and a decision
functions on which subspaces to search next given certain conditions
on the current state of the search. At each decision point, you compute
the next best choice, which includes all backtracking points. All
subspaces that aren't searched are marked as such backtracking points,
which is information about the space plus a continuation, which knows
how to resume the search in this world. Then you enter the next subsapce,
which is equivalent to throwing a continuation.
I know that there are many papers that use continuations for searches.
For most of these examples and most implementations, the algorithm is
neither as performant as one that passes continuations via closures
nor any easier to understand than one that explicitly manipulates
success and fail continuations.
My judgement for the second point is different when this kind of code
is what a macro expands into and continuations are highly performant.
----------------------------------------------------------------
Having said that, I do wish to emphasize that continuations are
useful in other contexts and every time I am about ready to throw
them out of a language, I find one more reason not to do so. Plus,
if you accept that the language should handle arbitrarily deep
recursion, you have all the implementation concepts worked out
anyway (mostly) so adding continuations to the language costs very
little.
-- Matthias
On Oct 26, 2014, at 9:24 PM, Hendrik Boom wrote:
> I've been sort of following Scheme since ages agoo when I read Guy
> Steele's masteer's thesis. I understand the concepts behind
> continuations. I understad some of the schemes by which they are
> implemented with multiple stacks, stack copying, or even Chey on the
> MTA.
>
> What I don't understand is what kinds of coding patterns are effective
> when using them to do really hairy search problems.
>
> Can anyone give me pointers to intelligible presentations of this kind
> of informmation?
>
> I seen no point in reinventing wheels.
>
> -- hendrik
>
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users