mirror of
https://github.com/HigherOrderCO/Kind.git
synced 2024-09-19 09:28:20 +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.
20 lines
606 B
Plaintext
20 lines
606 B
Plaintext
String.cmp
|
|
: ∀(a: String) ∀(b: String) Cmp
|
|
= λa λb
|
|
use P = λx ∀(b: String) Cmp
|
|
use cons = λa.head λa.tail λb
|
|
use P = λx ∀(a.head: Char) ∀(a.tail: String) Cmp
|
|
use cons = λb.head λb.tail λa.head λa.tail
|
|
use P = λx Cmp
|
|
use ltn = Cmp.ltn
|
|
use eql = (String.cmp a.tail b.tail)
|
|
use gtn = Cmp.gtn
|
|
(~(U60.cmp a.head b.head) P ltn eql gtn)
|
|
use nil = λa.head λa.tail Cmp.gtn
|
|
(~b P cons nil a.head a.tail)
|
|
use nil = λb
|
|
use P = λx Cmp
|
|
use cons = λb.head λb.tail Cmp.ltn
|
|
use nil = Cmp.eql
|
|
(~b P cons nil)
|
|
(~a P cons nil b) |