On Tue, Nov 3, 2009 at 10:58 PM, rob <r.p.l...@gmail.com> wrote:
>
> I'm pretty sure there was an example of this using continuations in
> Dybvig's book on Scheme.  I just flipped through it and didn't readily
> find it, but I think that is where I saw it.

You can do something like this (PLT Scheme):

#lang scheme

(define (foo n)
  (define (foo-helper return)
    (if (> n 0)
        (return n)
        (* -1 n)))
  (call/cc foo-helper))

(display (foo 10))

-- 
Chris Wilson <christopher.j.wil...@gmail.com>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to