Eban numbers: Difference between revisions
Content added Content deleted
m (→{{header|Tailspin}}: syntax update) |
m (→{{header|Haskell}}: simplify) |
||
Line 657: | Line 657: | ||
{{trans|Julia}} |
{{trans|Julia}} |
||
<lang haskell>{-# LANGUAGE NumericUnderscores #-} |
<lang haskell>{-# LANGUAGE NumericUnderscores #-} |
||
import Data.List ( |
import Data.List (intercalate) |
||
import Text.Printf (printf) |
import Text.Printf (printf) |
||
import Data.List.Split (chunksOf) |
import Data.List.Split (chunksOf) |
||
Line 669: | Line 669: | ||
z = b : map (\x -> if x >= 30 && x <= 66 then x `mod` 10 else x) [m, t, r3] |
z = b : map (\x -> if x >= 30 && x <= 66 then x `mod` 10 else x) [m, t, r3] |
||
ebans |
ebans = map f |
||
⚫ | |||
ebans = go |
|||
⚫ | |||
⚫ | |||
ebanCount = zip [1..] (filter isEban [1..]) |
|||
go [] = [] |
|||
go (x:xs) = case find (\(_, e) -> x < e) ebanCount of |
|||
⚫ | |||
Nothing -> go xs |
|||
thousands:: Int -> String |
thousands:: Int -> String |