We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a2161c8 commit fe92ac3Copy full SHA for fe92ac3
Ch4/aList.js
@@ -0,0 +1,21 @@
1
+// function arrayToList takes an array and outputs a list.
2
+// function prepend creates new list element and prepends it
3
+// function nth takes a list and a number and returns the nth element.
4
+// nth(rest, n-1)
5
+// list is {value, rest}, value is int and rest is another list element
6
+
7
+function arrayToList(input) {
8
9
+}
10
11
+function listToArray(list) {
12
13
14
15
+function prepend(element, list) {
16
17
18
19
+function nth(list, n) {
20
+ return n == 0 ? list.value : nth(list.rest, n-1);
21
0 commit comments