-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.solisp
executable file
·79 lines (65 loc) · 1.18 KB
/
test.solisp
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
#General system test
"Every line should return Passed"
#Math test
(If (==
(+ 3 2) # Each of these lines returns 5
(- 10 5)
(* 5 1)
(/ 20 4)
(% 15 10)
) "Passed" "Fail")
#Building and summing up lists
(If (< (+ (Set list (Seq 1 5))) 20) #{+ 1 2 3 4 5}
"Passed" "Fail")
#Mapping loops and product of a list
(If (* (Map x list (!= x 0)))
"Passed" "Fail")
#Alternate map function
(If (* (MapI x i list (> x i)))
"Passed" "Fail")
#Manual types
(If (== (Force Number "*") 42)
"Passed" "Fail")
#General list modifying
(Remove "," (JoinD "," (Reverse "e,d" "s" "s" "a" "P")))
#Step
(Step (Set start "Pass") {start "ed"})
#Switch statement
(Switch
{(== 5 3) "Fail1"}
{(> 6 10) "Fail2"}
{(!= 3 1) "Passed"}
{(< 3 0) "Fail3"}
{True "Fail4"}
)
#Name vs String
(Step
(Set Fail "Pass")
(Set e "Fail")
{Fail "e" d}
)
#Constructed Names
(Step
(Set "F1" "Pass")
(Set {"F" (+ 1 1)} "ed")
{(Force Name "F1") (Force Name {"F" 2})}
)
#Basic user-defined function
(If (== (
{{x y} (+ x y)}
2 3) 5)
"Passed" "Fail")
#Succesfull recursive function
(If (== ((Set fact {
{x}
(If (> x 0)
(+ x (fact (- x 1)))
0
)
}) 4) 10)
"Passed" "Fail")
#Weird formatting test
(If#Testing
1{"Pass" "ed"}"Fail"
)
args