summaryrefslogtreecommitdiff
path: root/Fractran/Interpreter.hs
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2014-04-10 05:25:03 +1000
committerJed Barber <jjbarber@y7mail.com>2014-04-10 05:25:03 +1000
commit281425310c5db21f87981eeb9601a71d1974d98d (patch)
treebef4643d906c93622c311fef2cf758fe94f1f651 /Fractran/Interpreter.hs
parente8695600977769008f285f9958eb043cca1b9b29 (diff)
Rearranging files
Diffstat (limited to 'Fractran/Interpreter.hs')
-rw-r--r--Fractran/Interpreter.hs29
1 files changed, 0 insertions, 29 deletions
diff --git a/Fractran/Interpreter.hs b/Fractran/Interpreter.hs
deleted file mode 100644
index 1393991..0000000
--- a/Fractran/Interpreter.hs
+++ /dev/null
@@ -1,29 +0,0 @@
-module Fractran.Interpreter (
- fractran
- ) where
-
-
-import Fractran.Parser
-
-
-
-
-fractran :: FractranProgram -> [Int]
-fractran program =
- let prog = map (\(x,y) -> (fromIntegral x, fromIntegral y)) (fractions program)
- f = (\p v -> if (p == [])
- then []
- else let (curX, curY) = head p
- newV = v * curX / curY
- in if (isInt newV)
- then newV : (f prog newV)
- else f (tail p) v)
- result = map round (f prog (fromIntegral (initialValue program)))
- in (initialValue program) : result
-
-
-
-isInt :: (RealFrac a) => a -> Bool
-isInt x =
- x == fromInteger (round x)
-