Hofstadter Figure-Figure sequences: Difference between revisions

→‎{{header|Haskell}}: Type signatures, minor tidying
(→‎{{header|Haskell}}: Applied Hlint, hindent to second Haskell version)
(→‎{{header|Haskell}}: Type signatures, minor tidying)
Line 955:
 
-- Functions by Reinhard Zumkeller
ffr :: Int -> Int
ffr n = rl !! (n - 1)
where
Line 962 ⟶ 963:
n_ = n + x
 
ffs :: Int -> Int
ffs n = rl !! n
where
Line 969 ⟶ 971:
n_ = n + x
 
main :: IO ()
main = do
print $ map ffr <$> [1 .. 10]
let i1000 = sort (mapfmap ffr [1 .. 40] ++ mapfmap ffs [1 .. 960])
print (i1000 == [1 .. 1000])</lang>
Output:
9,655

edits