mirror of
https://github.com/HigherOrderCO/Kind.git
synced 2024-10-26 16:20:58 +03:00
85ad65b026
Now, there are two local binders: let x = ... use x = ... The 'let' binder will create a local definition, type-check it, and assign a name to it. When compiled, it will create 'dup' nodes. The 'use' binder is just an alias. It will not bind a new variable, and, when compiled, will create inline copies. Also, for type-checking, it allows creating aliases that are definitionaly equal for the checker.
19 lines
570 B
Plaintext
19 lines
570 B
Plaintext
Kind.reduce.mat
|
|
: ∀(maj: Bool)
|
|
∀(nam: String)
|
|
∀(x: Kind.Term)
|
|
∀(z: Kind.Term)
|
|
∀(s: ∀(x: Kind.Term) Kind.Term)
|
|
∀(p: ∀(x: Kind.Term) Kind.Term)
|
|
Kind.Term
|
|
= λmaj λnam λx λz λs λp
|
|
use P = ∀(z: Kind.Term) ∀(s: ∀(x: Kind.Term) Kind.Term)
|
|
Kind.Term
|
|
use Y = λx.val
|
|
#match x = x.val {
|
|
#0: λz λs (Kind.reduce maj z)
|
|
#+: λz λs (Kind.reduce maj (s (Kind.num x-1)))
|
|
}: ∀(z: Kind.Term) ∀(s: ∀(x: Kind.Term) Kind.Term)
|
|
Kind.Term
|
|
use N = λx λz λs (Kind.mat nam x z s p)
|
|
(Kind.if.num x P Y N z s) |