-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRandom Qns.js
57 lines (41 loc) · 994 Bytes
/
Random Qns.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// function d(x) {
// if (x > 3) {
// return 5;
// } else {
// return x=> x;
// }
// }
// d(4);
// const f = (g, x) => () => ((x) => g(x * 2))(x);
// f(x=>x+1,3)();
// function f(g, x) {
// function d() {
// function c(x) {
// return g(x * 2);
// }
// return c(x);
// }
// return d;
// }
// f(x=>x+1, 3)();
// function f(g,x){
// return g(x*2);
// }
// function d_split_list(xs) {
// // *** Your answer here. ***
// const len = length(xs);
// let second_half = xs;
// let x = 0;
// while (x < math_ceil(len/2) -1){
// second_half = tail(second_half);
// x = x + 1;
// }
// let second_half1 = tail(second_half);
// set_tail(second_half, null);
// return pair(xs, second_half1);
// }
// // // TEST:
// const my_list1 = list(1, 2, 3, 4, 5);
// // const my_list2 = list(5, 4, 3, 2, 1);
// d_split_list(my_list1);
// // // d_split_list(my_list2);