-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.slt
28 lines (21 loc) · 805 Bytes
/
main.slt
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
lib "*std"
lib "*strict"
lib "*IO"
a <- Some{a :: (\a, b, c -> [[a, b*2], b, c]) {^:}' [8, 5] {^,}' [6, 3] {^,}' [1, 9]}
f <- \x*2
fcx: f <- \f, x -> change: x, 1, f <| \f, x -> change: x, 2, f <| f
mdLs <- \f -> change: a, 2, f <| fcx <| f
mod Shapes
Shape <- !Circle{r} | !Square{e} | !Triangle{a, b, c}
class getV: s
s@$Circle -> s.r*2
s@$Square -> s.e*2
s@$Triangle -> (s.a + s.b + s.c)/2
end
circ <- Shapes::Circle{r :: 15}
tri <- Shapes::Triangle{a :: 2, b :: 9, c :: 7}
!fib: n <- if bool: (\x<2) {^:} n then Strict::strict: 1 else add {^:}' (fib: dec fmap n) {^,}' (fib: 2decN fmap n)
out <- println: (Strict::applyT: fib) {^:} mlp2 {^,} (some: \x+circV) {^,} (repeatCmp: join, 3, mdLs[2][1][2]) where
mlp2 <- unit: &Maybe, double
circV <- Shapes::getV: circ
end