The Icon Programming Language

The threads on closures and continuations for Java reminds me of my erstwhile favorite language: Icon.

Icon is an Algol-family language with a twist. Functions and expressions can do much more than just return values: they can "fail", "suspend" values, and return values. "Suspended" function calls/expressions can be resumed where they suspended so that they can try again. Resumption is driven by downstream failure.

Under the hood the Icon compiler used CPS conversion and closures of dynamic extent (meaning: allocated on the stack, not on the heap) to implement continuations of dynamic extent (meaning: you could call a continuation only once and only while it remains in dynamic scope). Resumption was just a matter of calling the nearest suspended expression's continuation instead of the current continuation, whereas suspending and returning both involve calling the current continuation.

All of this makes Icon natural for implementing depth-first backtracking search algorithms.

If you wanted breadth-first backtracking, you could always use "co-expressions" (a form of co-routine adapted to Icon concepts), but it was a bit artificial. If you really wanted breadth-first backtracking you'd have to use continuations of indefinite extent under the hood.

I can't do Icon justice with some examples -- it's been too long since I've used it, but its website has lots of references and tutorials, and the main book about Icon is available in PDF.

Incidentally, there's an Icon-in-Java implementation: Jcon :)

Comments:

Hi Nico. Please fix the link to Icon website (http://www.cs.arizona.edu/icon/) ... currently it's pointing to this very post. Cheers, Tomas

Posted by Tomas on September 10, 2006 at 09:54 PM CDT #

Oops. That was a typo in my html that roller, er, helpfully, "fixed."

Posted by Nico on September 11, 2006 at 04:12 AM CDT #

Post a Comment:
Comments are closed for this entry.
About

I'm an engineer at Oracle (erstwhile Sun), where I've been since 2002, working on Sun_SSH, Solaris Kerberos, Active Directory interoperability, Lustre, and misc. other things.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today