7

I need to understand Continuations in Scheme for my upcoming exams and I have no idea about continuations at all. Can anyone please suggest me sources of how to go about learning continuations?

Regards,

darkie

name_masked
  • 9,544
  • 41
  • 118
  • 172
  • possible duplicate of http://stackoverflow.com/questions/612761/what-is-call-cc – Dave DeLong May 07 '10 at 03:51
  • @Dave: The thread seems to be talking about other programming languages not of my interest. Additionally, the information provided by Alex below is better from a beginner's perspective. Please let me know if any such links exist for beginners – name_masked May 07 '10 at 04:12

2 Answers2

8

I find this short draft tutorial a useful starting point. Once you grasp those very basics, a more extensive, Scheme-specific coverage is here; for a broader purview, wikipedia can be of some help (and has a few good links at the end).

Alex Martelli
  • 854,459
  • 170
  • 1,222
  • 1,395
  • Thanks Alex. I have a query from the link 'short draft tutorial'. The example has (+ 2 (call/cc (lambda (k) (set! handle k) 2))). Why do we have the rightmost 2 here? Is it because we need to associate the handle with continuation initially or is there some other reason to it? – name_masked May 07 '10 at 04:22
  • 1
    @darkie15, the rightmost `2` is the value the `call/cc` returns, making the expression result `4` (since that's `(+ 2 2)`!-); as a _side effect_, the `lambda` sets name `handle` to the continuation, so the short tutorial shows how to then treat `handle` like a function which performs `(+ 2 whatever)` on its argument `whatever`. – Alex Martelli May 07 '10 at 04:52
2

I wrote this short article to make myself more acquainted with continuations. You may find it useful. I have also collected some links there.

Vijay Mathew
  • 26,737
  • 4
  • 62
  • 93