Skip to content

Instantly share code, notes, and snippets.

@takikawa
Created August 1, 2012 16:18
$ from Okasaki's dissertation
#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