changed the implementation to call/cc
This commit is contained in:
@@ -1,13 +1,29 @@
|
||||
#lang racket/base
|
||||
|
||||
(provide define/return
|
||||
return
|
||||
;return
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; define/return
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(define-syntax define/return
|
||||
(syntax-rules ()
|
||||
((_ def return
|
||||
b1 ...)
|
||||
(define def
|
||||
(call/cc
|
||||
(λ (return)
|
||||
b1
|
||||
...)))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
#|
|
||||
|
||||
|
||||
(struct exn:return exn (value) #:transparent)
|
||||
|
||||
(define-syntax raise-return
|
||||
@@ -76,4 +92,4 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|#
|
||||
Reference in New Issue
Block a user