Skip to content

Commit

Permalink
An Ex of TSPL4 Sec3.3.Continuations
Browse files Browse the repository at this point in the history
  • Loading branch information
WuShaoa committed Oct 20, 2023
1 parent 69d6f55 commit 0431394
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions EOPL/funny_continuation.ss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
(((call/cc (lambda (k) k)) ;Returns the continuation k that applies proc1 to itself,
;then applies the proc1's return value (which is a self application) to proc2.
;The result is the infinite self application of proc2 to itself.
(lambda (x) ;proc1
(begin (display "HEY!")
(lambda (y) (y y)))))
(lambda (x) (begin (display "NOHEY!") ;proc2
(x x))))
; => HEY!NOHEY!NOHEY! ...

0 comments on commit 0431394

Please sign in to comment.