Allow lambda expressions without explicit paren
This commit is contained in:
@ -6,7 +6,7 @@ demo_true = t t
|
||||
not_TC? = t (t (t t) (t t t)) (t t (t t t))
|
||||
|
||||
-- /demos/toSource.tri contains an explanation of `triage`
|
||||
demo_triage = (\a b c : t (t a b) c)
|
||||
demo_triage = \a b c : t (t a b) c
|
||||
demo_matchBool = (\ot of : demo_triage
|
||||
of
|
||||
(\_ : ot)
|
||||
|
@ -17,9 +17,9 @@
|
||||
-- 4 5 6
|
||||
--
|
||||
|
||||
label = (\node : head node)
|
||||
label = \node : head node
|
||||
|
||||
left = (\node : if (emptyList? node)
|
||||
left = (\node : if (emptyList? node)
|
||||
[]
|
||||
(if (emptyList? (tail node))
|
||||
[]
|
||||
@ -39,7 +39,7 @@ processLevel = y (\self queue : if (emptyList? queue)
|
||||
(\node : not? (emptyList? node))
|
||||
(lconcat (map left queue) (map right queue))))))
|
||||
|
||||
levelOrderTraversal_ = (\a : processLevel (t a t))
|
||||
levelOrderTraversal_ = \a : processLevel (t a t)
|
||||
|
||||
toLineString = y (\self levels : if (emptyList? levels)
|
||||
""
|
||||
@ -47,11 +47,11 @@ toLineString = y (\self levels : if (emptyList? levels)
|
||||
(lconcat (map (\x : lconcat x " ") (head levels)) "")
|
||||
(if (emptyList? (tail levels)) "" (lconcat (t (t 10 t) t) (self (tail levels))))))
|
||||
|
||||
levelOrderToString = (\s : toLineString (levelOrderTraversal_ s))
|
||||
levelOrderToString = \s : toLineString (levelOrderTraversal_ s)
|
||||
|
||||
flatten = foldl (\acc x : lconcat acc x) ""
|
||||
|
||||
levelOrderTraversal = (\s : lconcat (t 10 t) (flatten (levelOrderToString s)))
|
||||
levelOrderTraversal = \s : lconcat (t 10 t) (flatten (levelOrderToString s))
|
||||
|
||||
exampleOne = levelOrderTraversal [("1")
|
||||
[("2") [("4") t t] t]
|
||||
|
@ -1,4 +1,4 @@
|
||||
compose = (\f g x : f (g x))
|
||||
compose = \f g x : f (g x)
|
||||
|
||||
succ = y (\self :
|
||||
triage
|
||||
|
@ -40,7 +40,7 @@ toSource_ = y (\self arg :
|
||||
arg) -- The term to be inspected
|
||||
|
||||
-- toSource takes a single TC term and returns a String
|
||||
toSource = (\v : toSource_ v "")
|
||||
toSource = \v : toSource_ v ""
|
||||
|
||||
exampleOne = toSource true -- OUT: "(t t)"
|
||||
exampleTwo = toSource not? -- OUT: "(t (t (t t) (t t t)) (t t (t t t)))"
|
||||
|
Reference in New Issue
Block a user