Created
August 1, 2012 16:18
$ from Okasaki's dissertation
This file contains 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 | |
(require (for-syntax syntax/parse)) | |
(define-match-expander $ | |
(λ (stx) | |
(syntax-parse stx | |
[(_ pat ...) | |
#'(app force pat ...)]))) | |
;; error | |
#; | |
(match (delay 5) | |
[5 'foo]) | |
;; matches | |
(match (delay 5) | |
[($ 5) 'foo]) | |
;; if $ were primitive | |
(define (my-force x) | |
(match x [($ x) x])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment