Continuations

home1 home2
 Bib
 Algorithms
 Bioinfo
 FP
 Logic
 MML
 Prog.Lang
and the
 Book

FP
 SML
  SML97
   Conts.

Also see:
Sem.
 e.g.
  Conts
 n-Queens

Continuations can be used to implement non-standard control mechanisms such as non-determinism (backtracking):


[an error occurred while processing this directive]
[[2,4,1,3,5], [3,1,4,2,5], [1,3,5,2,4], [2,5,3,1,4], [1,4,2,5,3], [5,2,4,1,3], [4,1,3,5,2], [5,3,1,4,2], [3,5,2,4,1], [4,2,5,3,1]] : int list list
  Q  
    Q
 Q   
   Q 
Q    
13524
e.g.

Note that either passes on its continuation twice, once to each its two alternatives, gen1 and gen2.

queens n can be read as, "do the following n times (doo n), choose an int between 1 and n inclusive (choose n) and (pipe) check that it does not invalidate the problem's constraints (filter valid) given the previous choices."

Notes

Continuations Implement Generators and Streams. The Computer J., 33(5), pp.460-465, 1990,
and more [conventional].
Coding Ockham's Razor, L. Allison, Springer

A Practical Introduction to Denotational Semantics, L. Allison, CUP

Linux
 Ubuntu
free op. sys.
OpenOffice
free office suite
The GIMP
~ free photoshop
Firefox
web browser

SML:
:: cons
[x1,...] list
[ ] list
@ append
fn =>  &lambda .
: has type
Compared

© L. Allison   http://www.allisons.org/ll/   (or as otherwise indicated),
Faculty of Information Technology (Clayton), Monash University, Australia 3800 (6/'05 was School of Computer Science and Software Engineering, Fac. Info. Tech., Monash University,
was Department of Computer Science, Fac. Comp. & Info. Tech., '89 was Department of Computer Science, Fac. Sci., '68-'71 was Department of Information Science, Fac. Sci.)
Created with "vi (Linux + Solaris)",  charset=iso-8859-1,  fetched Thursday, 28-Mar-2024 22:05:14 AEDT.