Email or username:

Password:

Forgot your password?
3 comments
Andrew Tropin

@wingo Thank you, I'll take a look!

ATM I worked around it like this:

(begin
(define (my-call/cc f)
(shift k (k (f k))))

(define (my-eval exp)
(reset
(primitive-eval exp)))

(my-eval `(define kont #f))
(my-eval `(+ 1 (my-call/cc (lambda (k) (set! kont k) 5))))
(my-eval `(kont 41)))

But don't know how good this idea is :)

I have another plan on how to improve the evaluation thread implementation, so call/cc doesn't break the value returning and interruption mechanisms.

@wingo Thank you, I'll take a look!

ATM I worked around it like this:

(begin
(define (my-call/cc f)
(shift k (k (f k))))

(define (my-eval exp)
(reset
(primitive-eval exp)))

(my-eval `(define kont #f))
(my-eval `(+ 1 (my-call/cc (lambda (k) (set! kont k) 5))))
(my-eval `(kont 41)))

But don't know how good this idea is :)

Andrew Tropin

@wingo It seems to preserve the semantics of call/cc, but probably there are some shortcomings in this implementation.

P.S. Oops, it doesn't preserve the semantics.

Andrew Tropin

@wingo I like the idea to make a default-prompt-tag a parameter: gitlab.com/spritely/guile-hoot

I also find your implementation quite similiar to what I tried to do with shift/reset above.

Thank you for sharing!

Go Up