-
Notifications
You must be signed in to change notification settings - Fork 8
/
initial_ast.js
31 lines (31 loc) · 2.66 KB
/
initial_ast.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
window.initialFunctionDefinitions = "map :: (a -> b) -> [a] -> [b]" + "\n" +
"map f [] = []" + "\n" +
"map f (x:xs) = (f x) : map f xs" + "\n" +
"" + "\n" +
"foldr :: (a -> b -> b) -> b -> [a] -> b" + "\n" +
"foldr f i [] = i" + "\n" +
"foldr f i (x:xs) = f x (foldr f i xs)" + "\n" +
"" + "\n" +
"foldl :: (a -> b -> a) -> a -> [b] -> a" + "\n" +
"foldl f i [] = i" + "\n" +
"foldl f i (x:xs) = foldl f (f i x) xs" + "\n" +
"" + "\n" +
"cons :: Int -> [Int] -> [Int]" + "\n" +
"cons x xs = x : xs" + "\n" +
"" + "\n" +
"reverseCons :: [Int] -> Int -> [Int]" + "\n" +
"reverseCons xs x = x : xs" + "\n" +
"" + "\n" +
"plus :: Int -> Int -> Int" + "\n" +
"plus x y = x + y" + "\n" +
"" + "\n" +
"addOne :: Int -> Int" + "\n" +
"addOne x = x + 1" + "\n" +
"" + "\n" +
"double :: Int -> Int" + "\n" +
"double x = x + x" + "\n" +
"" + "\n" +
"take :: Int -> [a] -> [a]" + "\n" +
"take 0 xs = []" + "\n" +
"take n [] = []" + "\n" +
"take n (x:xs) = (x : (take (n - 1) xs))" + "\n";