Merge branch 'master' of github.com:dopefishh/sec2014 into commentaar_verwerken
[sec1415.git] / functions.icl
diff --git a/functions.icl b/functions.icl
deleted file mode 100644 (file)
index 8250323..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-implementation module roll
-
-import StdInt, StdList
-
-d :: [Int] -> [Int]
-d [] = []
-d [a:rest] = rest
-
-e :: [Int] Int -> [Int]
-e [] a = [a]
-e [b] a = [a] ++ [b]
-
-add :: [Int] -> [Int]
-add [] = []
-add [a] = [a]
-add [a:b:rest] = [b+a:rest]
-
-sub :: [Int] -> [Int]
-sub [] = []
-sub [a] = [a]
-sub [a:b:rest] = [b-a:rest]
-
-mul :: [Int] -> [Int]
-mul [] = []
-mul [a] = [a]
-mul [a:b:rest] = [b*a:rest]
-
-div :: [Int] -> [Int]
-div [] = []
-div [a] = [a]
-div [a:b:rest] = [b/a:rest]
-
-modc :: [Int] -> [Int]
-modc[] = []
-modc[a] = [a]
-modc[a:b:rest] = [modulo b a:rest]
-
-dup :: [Int] -> [Int]
-dup[] = []
-dup[a:rest] = [a:a:rest]
-
-notc :: [Int] -> [Int]
-notc[] = []
-notc[0:rest] = [1:rest]
-notc[_:rest] = [0:rest]
-
-gre :: [Int] -> [Int]
-gre[] = []
-gre[a] = [a]
-gre[a:b:rest]
-|a >= b = [0:rest]
-|otherwise = [1:rest]
-
-roll :: [Int] -> [Int]
-roll [] = []
-roll [a] = [a]
-roll [a:b:rest]
-|modulo a b == 0 = rest
-|b <= 0 = rest
-|b > length rest = rest
-|a == 1 = roll1 [b:rest]
-|a > 0 = roll ([a-1] ++ [b] ++ roll1 [b:rest])
-|a < 0 = roll ([modulo a b] ++ [b:rest])
-
-pointer :: [Int] -> [Int]
-pointer [] = []
-pointer [a:rest] = rest
-
-//outnum_s :: stack_output  stack -> stack_output
-outnum_s :: [Int] [Int] -> [Int]
-outnum_s _ [] = []
-outnum_s _ [a:rest] = rest
-
-outnum_so :: [Int] [Int] -> [Int]
-outnum_so so [] = so
-outnum_so so [a:rest] = add_to_s a so
-
-//innum_s :: stack_input  stack -> stack
-innum_s :: [Int] [Int] -> [Int]
-innum_s [] _ = []
-innum_s [a:rest] s = add_to_s a s
-
-innum_si :: [Int] [Int] -> [Int]
-innum_si [] s = []
-innum_si [a:rest] s = rest
-
-//help functions
-roll1 :: [Int] -> [Int]
-roll1 [1:rest] = rest
-roll1 [b:c:d:rest] = [d] ++ roll1[b-1:c:rest]
-
-modulo :: Int Int -> Int
-modulo a b
-|a<0 = modulo (a+b) b
-|a<b = a
-|otherwise = modulo (a-b) b
-
-add_to_s :: a [a] -> [a]
-add_to_s a [] = [a]
-add_to_s a b = b ++ [a]
-
-x = 5
-y = 1
-stack = []
-so = []
-si = []
-
-Start = start51
-
-start21 = (notc(gre(sub(push 1(push 1(notc(sub(push 1(roll(push 1(push 3(dup(roll(push 1(push 2[2,1])))))))))))))))
-start22 = roll(push 1(push 2(pop(roll(push 2(push 3(sub(push 1(roll(push 1(push 3(dup(roll(push 1(push 2(pop(roll(push 1(push 2(mul(roll(push 1(push 4(dup(roll(push 2(push 3(dup[1,2]))))))))))))))))))))))))))))
-start23 = pointer(notc(gre(sub(push 1(push 1(notc(sub(push 1(roll(push 1(push 3(dup(roll(push 1(push 2(push 1 (push 2 stack)))))))))))))))))
-
-start51 = (notc(gre(sub(push 1(push 1(notc(sub(push 1(roll(push 1(push 3(dup(roll(push 1(push 2[120,1])))))))))))))))
-start52 = roll(push 1(push 2(pop(roll(push 2(push 3(sub(push 1(roll(push 1(push 3(dup(roll(push 1(push 2(pop(roll(push 1(push 2(mul(roll(push 1(push 4(dup(roll(push 2(push 3(dup[60,2]))))))))))))))))))))))))))))
-start53 = pointer(notc(gre(sub(push 1(push 1(notc(sub(push 1(roll(push 1(push 3(dup(roll(push 1(push 2[60,2])))))))))))))))
-start54 = roll(push 1(push 2(pop(roll(push 2(push 3(sub(push 1(roll(push 1(push 3(dup(roll(push 1(push 2(pop(roll(push 1(push 2(mul(roll(push 1(push 4(dup(roll(push 2(push 3(dup[20,3]))))))))))))))))))))))))))))
-start55 = pointer(notc(gre(sub(push 1(push 1(notc(sub(push 1(roll(push 1(push 3(dup(roll(push 1(push 2[20,3])))))))))))))))
-start56 = roll(push 1(push 2(pop(roll(push 2(push 3(sub(push 1(roll(push 1(push 3(dup(roll(push 1(push 2(pop(roll(push 1(push 2(mul(roll(push 1(push 4(dup(roll(push 2(push 3(dup[5,4]))))))))))))))))))))))))))))
-start57 = pointer(notc(gre(sub(push 1(push 1(notc(sub(push 1(roll(push 1(push 3(dup(roll(push 1(push 2[5,4])))))))))))))))
-start58 = roll(push 1(push 2(pop(roll(push 2(push 3(sub(push 1(roll(push 1(push 3(dup(roll(push 1(push 2(pop(roll(push 1(push 2(mul(roll(push 1(push 4(dup(roll(push 2(push 3(dup[1,5]))))))))))))))))))))))))))))
-start59 = pointer(notc(gre(sub(push 1(push 1(notc(sub(push 1(roll(push 1(push 3(dup(roll(push 1(push 2(push y (push x stack)))))))))))))))))