Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Functional > continuations i...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 7 Topic 2716 of 2912
Post > Topic >>

continuations in SML

by Michele Simionato <michele.simionato@[EMAIL PROTECTED] > Jan 5, 2008 at 10:15 PM

I see that both SML/NJ and MLTon provide continuations, however
their usage is somewhat different than in Scheme. Can somebody
provide a translation of the following toy Scheme program into SML?

(define-macro (store/cc! name . body)
   (let ((k (gensym)))
    `(call-with-current-continuation
      (lambda (,k) (set! ,name ,k) ,@[EMAIL PROTECTED]
))))

(define cont #f); make room for the continuation
(display (+ 1 (store/cc! cont 0))) ;=> displays 1
(cont 1) ;=> displays 2

That would help me quite a lot in figuring out the correspondence
Scheme <-> SML. TIA,

      Michele Simionato
 




 7 Posts in Topic:
continuations in SML
Michele Simionato <mic  2008-01-05 22:15:11 
Re: continuations in SML
Vesa Karvonen <vesa.ka  2008-01-06 12:00:29 
Re: continuations in SML
Michele Simionato <mic  2008-01-06 04:32:28 
Re: continuations in SML
Benedikt Rosenau <rose  2008-01-11 17:45:58 
Re: continuations in SML
Abdulaziz Ghuloum <agh  2008-01-12 03:14:19 
Re: continuations in SML
Abdulaziz Ghuloum <agh  2008-01-12 03:48:47 
Re: continuations in SML
Benedikt Rosenau <rose  2008-01-13 22:58:48 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 26 4:17:00 CDT 2008.