Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

continuations

Name: Anonymous 2013-03-02 2:18

In this thread, you may post code that makes use of continuations, and I will attempt to produce code that does the same and looks reasonably similar, without using continuations.

Name: Anonymous 2013-03-03 21:43

>>60
After further inspection of amb, it has come to my attention that the interface is dependant on mutations. Hence, my religious convictions prevent me from implementing it, as it's interface is inherently flawed and harmful. Thus rather that using amb, I will explicitly use lazy lists that call functions which emulate continuations. As shown in this example...................................................................................................................................................................

http://mitpress.mit.edu/sicp/full-text/sicp/book/node91.html

(if-fail (let ((x (an-element-of '(1 3 5 8))))
           (require (even? x))
           x)
         'all-odd)



(let ((success (lambda (x) x))
      (fail (lambda () 'all-odd)))
  (an-element-of '(1 3 5 8) (lambda (x fail)
                              (if (even? x)
                                (success x)
                                (fail)))
                            fail))

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List