forked from jeapostrophe/exp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlazy-ex.ss
52 lines (47 loc) · 1.16 KB
/
lazy-ex.ss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#lang scheme
;(require "lazy.ss")
(require "lazy-marks.ss")
(define-syntax-rule (+^ e ...)
(promise* (lambda () (+ (force* e) ...))))
(define-syntax-rule (/^ e ...)
(promise* (lambda () (/ (force* e) ...))))
(with-handlers ([(lambda _ #t)
(lambda (x) x)])
(force*
(with-continuation-mark
'test 0
(+^ 10
(/^ 10
(promise*
(lambda ()
(raise
(continuation-mark-set->list
(current-continuation-marks)
'test)))))))))
(with-handlers ([(lambda _ #t)
(lambda (x) x)])
(with-continuation-mark
'test 0
(+ 10
(/ 10
(raise
(continuation-mark-set->list
(current-continuation-marks)
'test))))))
(with-handlers ([(lambda _ #t)
(lambda (x) x)])
(force*
(with-continuation-mark
'test 0
(+^ 10
(/^ 10
(promise*
(lambda ()
5)))))))
(with-handlers ([(lambda _ #t)
(lambda (x) x)])
(with-continuation-mark
'test 0
(+ 10
(/ 10
5))))