Lambda Calculus
Check-in [78cbffa39c]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:changed definition of nil to use explicit lambda, instead of false
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:78cbffa39c1a364be22e602b73bacfb6c7ad525f
User & Date: bill 2012-01-09 14:24:29
Context
2012-03-15
03:13
changed to support node.js modules check-in: a29ab74885 user: bill tags: trunk
2012-01-09
14:24
changed definition of nil to use explicit lambda, instead of false check-in: 78cbffa39c user: bill tags: trunk
2011-12-21
10:52
better person record expln better list constructur expln check-in: 647446e14d user: bill tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to evaluator.html.

109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# DUMMY can be anything, but it needs to be there
# here's how you use a list:
# aList (\h t DUMMY . {list-case}) {empty-case}
# If the list is not empty, h and t are the head and tail of the list and it returns list-case.  DUMMY is not used, but needs to be there
# If the list is empty, it returns empty-case
# these defs are required by the pretty-printer: cons, nil, head, tail
cons = \a b f . f a b
nil = false
head = \l . l \h t . h
tail = \l . l \h t . t
null = \l . l (\h t D . false) true
last = rec \last l  . l (\h t D . null t h (last t)) nil
append = rec \append l1 l2 . l1 (\h t D . cons h (append t l2)) l2
reverse = \l . (rec \rev l res . l (\h t D . rev t (cons h res)) res) l nil
# list constructor: list 1 , 2 , 3 end







|







109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# DUMMY can be anything, but it needs to be there
# here's how you use a list:
# aList (\h t DUMMY . {list-case}) {empty-case}
# If the list is not empty, h and t are the head and tail of the list and it returns list-case.  DUMMY is not used, but needs to be there
# If the list is empty, it returns empty-case
# these defs are required by the pretty-printer: cons, nil, head, tail
cons = \a b f . f a b
nil = \x y . y
head = \l . l \h t . h
tail = \l . l \h t . t
null = \l . l (\h t D . false) true
last = rec \last l  . l (\h t D . null t h (last t)) nil
append = rec \append l1 l2 . l1 (\h t D . cons h (append t l2)) l2
reverse = \l . (rec \rev l res . l (\h t D . rev t (cons h res)) res) l nil
# list constructor: list 1 , 2 , 3 end