Drop backslash from lambda definitions

This commit is contained in:
2025-04-15 10:34:38 -05:00
parent 5024a2be4c
commit f2beb86d8a
16 changed files with 181 additions and 182 deletions

View File

@ -1,68 +1,68 @@
!import "base.tri" !Local
matchList = \a b : triage a _ b
matchList = a b : triage a _ b
emptyList? = matchList true (\_ _ : false)
head = matchList t (\head _ : head)
tail = matchList t (\_ tail : tail)
emptyList? = matchList true (_ _ : false)
head = matchList t (head _ : head)
tail = matchList t (_ tail : tail)
append = y (\self : matchList
(\k : k)
(\h r k : pair h (self r k)))
append = y (self : matchList
(k : k)
(h r k : pair h (self r k)))
lExist? = y (\self x : matchList
lExist? = y (self x : matchList
false
(\h z : or? (equal? x h) (self x z)))
(h z : or? (equal? x h) (self x z)))
map_ = y (\self :
map_ = y (self :
matchList
(\_ : t)
(\head tail f : pair (f head) (self tail f)))
map = \f l : map_ l f
(_ : t)
(head tail f : pair (f head) (self tail f)))
map = f l : map_ l f
filter_ = y (\self : matchList
(\_ : t)
(\head tail f : matchBool (t head) id (f head) (self tail f)))
filter = \f l : filter_ l f
filter_ = y (self : matchList
(_ : t)
(head tail f : matchBool (t head) id (f head) (self tail f)))
filter = f l : filter_ l f
foldl_ = y (\self f l x : matchList (\acc : acc) (\head tail acc : self f tail (f acc head)) l x)
foldl = \f x l : foldl_ f l x
foldl_ = y (self f l x : matchList (acc : acc) (head tail acc : self f tail (f acc head)) l x)
foldl = f x l : foldl_ f l x
foldr_ = y (\self x f l : matchList x (\head tail : f (self x f tail) head) l)
foldr = \f x l : foldr_ x f l
foldr_ = y (self x f l : matchList x (head tail : f (self x f tail) head) l)
foldr = f x l : foldr_ x f l
length = y (\self : matchList
length = y (self : matchList
0
(\_ tail : succ (self tail)))
(_ tail : succ (self tail)))
reverse = y (\self : matchList
reverse = y (self : matchList
t
(\head tail : append (self tail) (pair head t)))
(head tail : append (self tail) (pair head t)))
snoc = y (\self x : matchList
snoc = y (self x : matchList
(pair x t)
(\h z : pair h (self x z)))
(h z : pair h (self x z)))
count = y (\self x : matchList
count = y (self x : matchList
0
(\h z : matchBool
(h z : matchBool
(succ (self x z))
(self x z)
(equal? x h)))
last = y (\self : matchList
last = y (self : matchList
t
(\hd tl : matchBool
(hd tl : matchBool
hd
(self tl)
(emptyList? tl)))
all? = y (\self pred : matchList
all? = y (self pred : matchList
true
(\h z : and? (pred h) (self pred z)))
(h z : and? (pred h) (self pred z)))
any? = y (\self pred : matchList
any? = y (self pred : matchList
false
(\h z : or? (pred h) (self pred z)))
(h z : or? (pred h) (self pred z)))
intersect = \xs ys : filter (\x : lExist? x ys) xs
intersect = xs ys : filter (x : lExist? x ys) xs