diff options
-rw-r--r-- | fibo.rip | 2 | ||||
-rw-r--r-- | rip.hs | 20 | ||||
-rw-r--r-- | testif.rip | 8 |
3 files changed, 16 insertions, 14 deletions
@@ -2,5 +2,5 @@ 1W[ DO 9io - D3r+ + D3ra 1] @@ -45,10 +45,10 @@ rip' (x:xs) st = case x of n | '0' <= n && n <= '9' -> rip' xs (fromIntegral (ord n - ord '0') : st) - 'p' -> + 'P' -> rip' xs (tail st) - 's' -> + 'S' -> rip' xs (b:a:cs) where (a:b:cs) = st @@ -77,31 +77,31 @@ rip' (x:xs) st = case x of (begin, rest) = (take (fromIntegral n) newst, drop (fromIntegral n) newst) res = last begin : init begin ++ rest --SLOW! - '+' -> + 'a' -> rip' xs (a + b : cs) where (b:a:cs) = st - '-' -> + 's' -> rip' xs (a - b : cs) where (b:a:cs) = st - '*' -> + 'm' -> rip' xs (a * b : cs) where (b:a:cs) = st - '/' -> + 'q' -> rip' xs (a `div` b : cs) where (b:a:cs) = st - '>' -> + 'G' -> rip' xs (booltoint (a > b) : cs) where (b:a:cs) = st - '<' -> + 'L' -> rip' xs (booltoint (a < b) : cs) where (b:a:cs) = st - '=' -> + 'E' -> rip' xs (booltoint (a == b) : cs) where (b:a:cs) = st @@ -144,7 +144,7 @@ rip' (x:xs) st = case x of c <- getChar rip' xs (fromIntegral (ord c) : st) - 'S' -> do + '$' -> do print st rip' xs st @@ -1,4 +1,6 @@ -2 1 > -I [1 O] -2 1 < +49im2aO 9io +2 1 G +D I [1 O] +1 S s I [0 O] +9io |