Skip to content

Commit 3582e40

Browse files
authored
Update README.md
1 parent b849f2c commit 3582e40

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,16 @@ For example, if our input was [1, 2, 3, 4, 5], the expected output would be [120
3636
Follow-up: what if you can't use division? see the methods calculateNewArray4 and calculateNewArray5
3737

3838
---
39+
## ConstructPairAndReturnFirstAndLast.py
40+
41+
cons(a, b) constructs a pair, and car(pair) and cdr(pair) returns the first and last element of that pair. For example, car(cons(3, 4)) returns 3, and cdr(cons(3, 4)) returns 4.
42+
43+
Given this implementation of cons:
44+
45+
def cons(a, b):
46+
def pair(f):
47+
return f(a, b)
48+
return pair
49+
50+
51+
Implement car and cdr.

0 commit comments

Comments
 (0)