From 9e93ee268269a7f289dd2a936670842e07db5237 Mon Sep 17 00:00:00 2001 From: "Chris K. Jester-Young" Date: Wed, 27 Feb 2013 13:18:09 -0500 Subject: [PATCH] Convert srfi/61/cond to use modern module style. This ensures that `=>` and `else` have the same bindings as the ones in `racket/private/cond`; otherwise it would not be possible to use SRFI 61 `cond` from a `#lang racket/base` program/module. Tested under both `#lang racket` and `#lang mzscheme`. --- collects/srfi/61/cond.rkt | 54 +++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/collects/srfi/61/cond.rkt b/collects/srfi/61/cond.rkt index dde7cb38ab..8a942846f8 100644 --- a/collects/srfi/61/cond.rkt +++ b/collects/srfi/61/cond.rkt @@ -1,30 +1,30 @@ ;;SRFI 61 A more general COND clause ;;Chongkai Zhu mrmathematica@yahoo.com ;;12-18-2005 -(module cond mzscheme - - (provide (rename my-cond srfi:cond)) - - (define-syntax my-cond - (syntax-rules (=> else) - ((_ (else else1 else2 ...)) - (if #t (begin else1 else2 ...))) - ((_ (test => receiver) more-clause ...) - (let ((t test)) - (if t - (receiver t) - (my-cond more-clause ...)))) - ((_ (generator guard => receiver) more-clause ...) - (call-with-values (lambda () generator) - (lambda t - (if (apply guard t) - (apply receiver t) - (my-cond more-clause ...))))) - ((_ (test) more-clause ...) - (or test (my-cond more-clause ...))) - ((_ (test body ...) more-clause ...) - (if test - (begin body ...) - (my-cond more-clause ...))) - ((_) - (void))))) +;; * Updated by Chris Jester-Young 2013-02-28 +#lang racket/base +(provide (prefix-out srfi: (combine-out cond => else))) + +(define-syntax cond + (syntax-rules (=> else) + ((_ (else else1 else2 ...)) + (when #t (begin else1 else2 ...))) + ((_ (test => receiver) more-clause ...) + (let ((t test)) + (if t + (receiver t) + (cond more-clause ...)))) + ((_ (generator guard => receiver) more-clause ...) + (call-with-values (lambda () generator) + (lambda t + (if (apply guard t) + (apply receiver t) + (cond more-clause ...))))) + ((_ (test) more-clause ...) + (or test (cond more-clause ...))) + ((_ (test body ...) more-clause ...) + (if test + (begin body ...) + (cond more-clause ...))) + ((_) + (void))))