blob: c58331416a411c666632de4885a4b78e077d31cf (
plain)
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
|
; Probably not going to implement this,
; just writing down ideas
; lowercase types: polymorphic
; everything else: monomorphic
(type . (\[
(\[b] c) ; f
(\[a] b)] ; g
(\[a] c)))
(let
. (\[f g] (\[x] (f (g x)))))
((. (+ 1) (+ 2)) 3)
(type id (\[a] a))
(let id (\[a] a))
(type mod (\[Int Int] Int))
(let mod (\[n k]
(- n (* k (/ n k)))))
(type not (\[Bool] Bool))
(let not (\[b]
(match b
true false
false true)))
(type even? (\[Int] Bool))
(let even? (\[n]
(match (mod n 2)
0 true
1 false)))
; match cannot be type annotated because its variadic
; but the match above is inferred as this:
(type match (\[a a b a b] b))
|