-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathproblems.json
113 lines (113 loc) · 2.47 KB
/
problems.json
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
[
{
"title": "Level 1: First Steps",
"tests": [
{
"name": "sums",
"type": "raw",
"prompt": "What will 1+2 evaluate to?",
"wants": "3",
"hints": {
"2" : "You'll need to sum both numbers.",
"42" : "Very funny, but still wrong.",
"12" : "The + operator is sum, not concatenate."
}
},
{
"name": "obvious order",
"type": "raw",
"prompt": "Ok, how about 2+3*5?",
"wants": "17"
},
{
"name": "non-obvious order",
"type": "raw",
"prompt": "And what about 2*3+5?",
"wants": "16",
"hints": {
"11" : "Expressions evaluate strictly right to left without obeying precedence.",
"235" : "Numbers still aren't strings."
}
}
]
},
{
"title": "Level 2: Conformism",
"tests": [
{
"name": "space separated list",
"type": "raw",
"prompt": "What will 1 2 evaluate to?",
"wants": "1 2"
},
{
"name": "atom-list conform",
"type": "raw",
"prompt": "So then, what will 1+2 3 evaluate to?",
"wants": "3 4",
"hints": {
"1 2 3": "The + operator is sum, not concatenate.",
"3 3": "The the sum of a scalar and a vector adds the scalar to each vector element."
}
},
{
"name": "list-list conform",
"type": "raw",
"prompt": "How about 2 3+5 10?",
"wants": "7 13",
"hints": {
"2 8 10": "Remember, 2 3 is a list, and so is 5 10."
}
}
]
},
{
"title": "Level 3: Functionality",
"tests": [
{
"name": "increment",
"type": "func",
"prompt": "Write a monad which increments its input by one.",
"cases": [
{
"args":"[5]",
"wants":"6",
"hint":"Incrementing 5 should produce 6."
},
{
"args":"[0]",
"wants":"1",
"hint":"Incrementing 0 should produce 1."
},
{
"args":"[1 2 3]",
"wants":"2 3 4",
"hint":"This definition should work for lists as well as scalars."
}
]
},
{
"name": "abs",
"type": "func",
"prompt": "Write a monad which returns the absolute value of its input.",
"cases": [
{
"args":"[234]",
"wants":"234",
"hint":"The absolute value of a positive number remains the same."
},
{
"args":"[-967.8]",
"wants":"967.8",
"hint":"The absolute value of a negative number should be positive."
},
{
"args":"[0 24 -34 -9999]",
"wants":"0 24 34 9999",
"hint":"This definition should work for lists as well as scalars."
}
]
}
]
}
]