racket/collects/srfi/8/receive.ss
2008-03-16 15:21:29 +00:00

23 lines
775 B
Scheme

;;;
;;; <receive.ss> ---- SRFI 8 Binding to Multiple Values port to PLT Scheme
;;; Time-stamp: <02/05/10 12:22:37 solsona>
;;;
;;; Usually, I would add a copyright notice, and the announce that
;;; this code is under the LGPL licence. Nevertheless, I only did the
;;; port to PLT Scheme v200 (it was written for the 103), and here is
;;; the copyright notice, comments, and licence from the original
;;; source:
;;;
;;; oh well, there is no such comment.
#lang scheme/base
(provide receive)
;; (receive vars producer . body)
(define-syntax receive
(syntax-rules ()
((receive (var ...) ?producer . ?body)
(let-values ([(var ...) ?producer]) . ?body))
((receive ?vars ?producer . ?body)
(call-with-values (lambda () ?producer) (lambda ?vars . ?body)))))