Allow lambda expressions without explicit paren
This commit is contained in:
		
							
								
								
									
										32
									
								
								lib/base.tri
									
									
									
									
									
								
							
							
						
						
									
										32
									
								
								lib/base.tri
									
									
									
									
									
								
							| @ -7,15 +7,15 @@ s     = t (t (k t)) t | ||||
| m     = s i i | ||||
| b     = s (k s) k | ||||
| c     = s (s (k s) (s (k k) s)) (k k) | ||||
| id    = (\a : a) | ||||
| id    = \a : a | ||||
| pair  = t | ||||
| if    = (\cond then else : t (t else (t t then)) t cond) | ||||
| if    = \cond then else : t (t else (t t then)) t cond | ||||
|  | ||||
| y = ((\mut wait fun : wait mut (\x : fun (wait mut x))) | ||||
|      (\x : x x) | ||||
|      (\a0 a1 a2 : t (t a0) (t t a2) a1)) | ||||
|  | ||||
| triage = (\leaf stem fork : t (t leaf stem) fork) | ||||
| triage = \leaf stem fork : t (t leaf stem) fork | ||||
| test   = triage "Leaf" (\_ : "Stem") (\_ _ : "Fork") | ||||
|  | ||||
| matchBool = (\ot of : triage  | ||||
| @ -24,17 +24,9 @@ matchBool = (\ot of : triage | ||||
|   (\_ _ : ot) | ||||
| ) | ||||
|  | ||||
| matchList = (\oe oc : triage  | ||||
|   oe  | ||||
|   _  | ||||
|   oc | ||||
| ) | ||||
| matchList = \a b : triage a _ b | ||||
|  | ||||
| matchPair = (\op : triage  | ||||
|   _  | ||||
|   _  | ||||
|   op | ||||
| ) | ||||
| matchPair = \a   : triage _ _ a | ||||
|  | ||||
| not? = matchBool false true | ||||
| and? = matchBool id (\_ : false) | ||||
| @ -50,20 +42,18 @@ lconcat = y (\self : matchList | ||||
| lAnd = (triage  | ||||
|   (\_     : false)  | ||||
|   (\_ x   : x)  | ||||
|   (\_ _ x : x) | ||||
| ) | ||||
|   (\_ _ x : x)) | ||||
|  | ||||
| lOr = (triage  | ||||
|   (\x     : x)  | ||||
|   (\_ _   : true)  | ||||
|   (\_ _ _ : true) | ||||
| ) | ||||
|   (\_ _ _ : true)) | ||||
|  | ||||
| map_ = y (\self :  | ||||
|   matchList  | ||||
|     (\_ : t)  | ||||
|     (\head tail f : pair (f head) (self tail f))) | ||||
| map = (\f l : map_ l f) | ||||
| map = \f l : map_ l f | ||||
|  | ||||
| equal? = y (\self : triage  | ||||
|   (triage  | ||||
| @ -84,10 +74,10 @@ equal? = y (\self : triage | ||||
| filter_ = y (\self : matchList  | ||||
|   (\_ : t)  | ||||
|   (\head tail f : matchBool (t head) i (f head) (self tail f))) | ||||
| filter  = (\f l : filter_ l 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  = \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  = \f x l : foldr_ x f l | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 James Eversole
						James Eversole