Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,16 @@
bellTri :: [[Integer]]
bellTri =
let f xs = (last xs, xs)
in map snd (iterate (f . uncurry (scanl (+))) (1, [1]))
bell :: [Integer]
bell = map head bellTri
main :: IO ()
main = do
putStrLn "First 10 rows of Bell's Triangle:"
mapM_ print (take 10 bellTri)
putStrLn "\nFirst 15 Bell numbers:"
mapM_ print (take 15 bell)
putStrLn "\n50th Bell number:"
print (bell !! 49)

View file

@ -0,0 +1,4 @@
import Control.Arrow
bellTri :: [[Integer]]
bellTri = map snd (iterate ((last &&& id) . uncurry (scanl (+))) (1,[1]))

View file

@ -0,0 +1,4 @@
import Control.Applicative
bellTri :: [[Integer]]
bellTri = map snd (iterate ((liftA2 (,) last id) . uncurry (scanl (+))) (1,[1]))

View file

@ -0,0 +1,2 @@
bellTri :: [[Integer]]
bellTri = map snd (iterate (((,) . last <*> id) . uncurry (scanl (+))) (1, [1]))