Created
April 21, 2011 20:05
-
-
Save samth/935350 to your computer and use it in GitHub Desktop.
lambda/prop in Racket
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #lang racket | |
| (struct proc/prop (f v) | |
| #:property prop:procedure 0) | |
| (define (procedure-property p [fail #f]) | |
| (if (proc/prop? p) | |
| (proc/prop-v p) | |
| fail)) | |
| (define-syntax-rule (lambda/prop #:prop e formals . body) | |
| (proc/prop (λ formals . body) | |
| e)) | |
| (provide lambda/prop procedure-property) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A sample interaction: