addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscontroller-playcrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1light-bulblinklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonprintShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruserwarningyahoo

Special Session: Continuations programming in racket

  • Feb 20, 2014 · 7:00 PM
  • NBCUniversal, Third floor

We're taking a break from SICP for one week to look at continuations; they're a sort of grand-daddy of control structure (for-loops, exceptions, et cetera) in programming languages.  In a brief (and mostly wrong) nutshell, continuations are an abstraction of the current state of a computation.

When languages, like Racket and Scheme, make continuations a first-class object, the program can stop its own execution, save it, and pass it around in functions and macros, and perform transformations on it.  First class continuations allow a program to modify its own execution on the fly.

One might use continuations in a compiler design to implement lower level control structures, like exceptions, or use them more practically, like to control the state of threads in a web server, which is done in the Racket standard library.

In this session we'll begin with a 20-30min intro to continuations, followed by our usual dojo - working through 2-3 problems in a pair-programming fashion.  Here's some suggested reading to help you prep:

Continuation passing style by example in javascript - Matt Might
Racket Guide on Continuations - Racket docs
Systems programming in racket - Racket docs (practical, real-world use of continuations)

Of course, since this is a special session, there's no need for you to do any SICP prep before joining us.  If you haven't joined us before, this is the perfect time.

Join or login to comment.

  • Christian J.

    I've finally pushed my solutions to this meetup, including a full CPS transform of the looping exercise, that I promised to some of you. (Hm, I'm not holding my high-spirited promise to show full CPS transform of *all* the exercises, though. I'll make up for this by showing you code to do the CPS transform automatically later, when I've got the Scheme compiler ready.)

    https://github.com/pflanze/sicp-london/blob/master/Feb20/continuations.scm

    It took me quite some time to figure out actually (without looking up other sources), since I was confused about whether continuations should be functions that take a continuation themselves or not, or rather, since they really can't take a continuation, then how are continuations compatible with functions? Well the solution is that they aren't, call/cc wraps them up in a function (closure) in the actual implementation.

    March 6, 2014

  • james c.

    This was a bit of a tough one-did not get it, but am motivated to learn about them.

    February 21, 2014

  • Christian J.

    I'm currently writing a simple Scheme compiler that will transform programs to continuation passing style before outputting to bytecode. I think I'll be able to show its workings in a few weeks, if people are interested.

    4 · February 20, 2014

    • Maris O.

      Java bytecode ? LLVM ?

      February 20, 2014

    • Christian J.

      I've written my own bytecode assembly and interpreter, that was simplest :). I've also looked into x86_64 assembly, but there seems to be no way around the multi-thousand page original Intel documentation to get to the byte code format, so I gave up on that; for performance, it would have to be LLVM anyway.

      February 20, 2014

  • Michael

    Sorry Matthew, I am double booked with Agile London. Have been going through the material and was looking forward to this.

    February 20, 2014

  • Davin T.

    Sorry, Matthew. Came down with the flu today. See you next time.

    February 20, 2014

  • charalampos p.

    sry cant make it this time. ill try to be there on the next one. have fun

    February 13, 2014

12 went

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy