(module plt-fix mzscheme (provide cond-expand require-extension (all-from (lib "include.ss"))) (require (lib "include.ss")) ;; srfi-0 (define-syntax cond-expand (syntax-rules (and or not else srfi-0 plt) ;; ((cond-expand) (syntax-error "Unfulfilled cond-expand")) ((cond-expand (else body ...)) (begin body ...)) ((cond-expand ((and) body ...) more-clauses ...) (begin body ...)) ((cond-expand ((and req1 req2 ...) body ...) more-clauses ...) (cond-expand (req1 (cond-expand ((and req2 ...) body ...) more-clauses ...)) more-clauses ...)) ((cond-expand ((or) body ...) more-clauses ...) (cond-expand more-clauses ...)) ((cond-expand ((or req1 req2 ...) body ...) more-clauses ...) (cond-expand (req1 (begin body ...)) (else (cond-expand ((or req2 ...) body ...) more-clauses ...)))) ((cond-expand ((not req) body ...) more-clauses ...) (cond-expand (req (cond-expand more-clauses ...)) (else body ...))) ((cond-expand (srfi-0 body ...) more-clauses ...) (begin body ...)) ((cond-expand (plt body ...) more-clauses ...) (begin body ...)) ((cond-expand (feature-id body ...) more-clauses ...) (cond-expand more-clauses ...)))) (define-syntax (require-extension stx) (syntax-case stx (srfi) ((_ (srfi n)) (number? (syntax-e #'n)) (with-syntax ([path (datum->syntax-object #'n `(lib ,(format "~a.ss" (syntax-e #'n)) "srfi"))]) #'(require path))))) )