September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -1,11 +1,19 @@
import Data.List (intercalate)
base :: Int
base = 8
to :: Int -> [Int]
to 0 = []
to i = to (div i base) ++ [mod i base]
from = foldl1 (\x y -> x*base + y)
from :: [Int] -> Int
from = foldl1 ((+) . (base *))
main = do
fancy 2097152
fancy 2097151
where fancy i = putStrLn $ concatMap show (to i) ++ " <-> " ++ show (from $ to i)
main :: IO ()
main =
mapM_
(putStrLn .
intercalate " <-> " .
(((:) . concatMap show . to) <*> (return . show . from . to)))
[2097152, 2097151]