Fractran: Difference between revisions
Content added Content deleted
m (Minor linting of English grammar in task description (step -> steps)) |
m (→Reading the program: (specialized a type signature slightly to enable compilation)) |
||
Line 1,759: | Line 1,759: | ||
Additional import |
Additional import |
||
<lang Haskell>import Data.List.Split (splitOn)</lang> |
<lang Haskell>import Data.List.Split (splitOn)</lang> |
||
<lang Haskell>readProgram :: String -> [Ratio |
<lang Haskell>readProgram :: String -> [Ratio Int] |
||
readProgram = map (toFrac . splitOn "/") . splitOn "," |
readProgram = map (toFrac . splitOn "/") . splitOn "," |
||
where toFrac [n,d] = read n % read d</lang> |
where toFrac [n,d] = read n % read d</lang> |