-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisco-lang.rkt
40 lines (29 loc) · 869 Bytes
/
disco-lang.rkt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#lang racket
(provide (except-out (all-from-out racket)
λ)
(rename-out [match-lambda λ]
[match-lambda** λ*]#;[app #%app]))
#;(define-syntax-rule (my-λ [<pat <expr ...] ...)
(match-lambda* [<pat <expr ...] ...))
; TODO: check out match/derived for better error reporting
#|
want to override:
λ
lambda (can use match-λ?)
(λ (x) x) versus (λ [x x]) - same char count
variadic lambda? just do (λ . pairs ...) ?
let (can use match-let)
let*
letrec
define
define/fn
for/list
for/fold
|#
#;(module Maybe racket
(provide (rename-out (maybe-call #%app) (#%app :)))
(define-syntax maybe-call
(syntax-rules ()
[(maybe-call f e) (match f ['fail 'fail] [f′ (match e ['fail 'fail] [e′ (f′ e′)])])]
[(maybe-call f e0 e ...) (maybe-call (maybe-call f e0) e ...)])))
#;(require 'Maybe)