Hofstadter Figure-Figure sequences: Difference between revisions
→{{header|Haskell}}: Applied Hlint, hindent to second Haskell version
(→{{header|Haskell}}: Applied hlint hindent, adjusted one name to side-step Wiki formatting glitch) |
(→{{header|Haskell}}: Applied Hlint, hindent to second Haskell version) |
||
Line 980:
<lang haskell>import Data.List (sort)
r :: [Int]
r = scanl (+) 1 s
s = 2:4:tail (compliment (tail r)) where▼
compliment = concat.interval▼
interval x = zipWith (\x y -> [x+1..y-1]) x (tail x)▼
s :: [Int]
where
main :: IO ()
main = do
print (take 10 s)
print ([1..1000] == sort ((take 40 r) ++ (take 960 s)))</lang>▼
putStr "test 1000: "
output:
<pre>
|