Help us understand the problem. What is going on with this article?

フィボナッチ数列でFizzBuzz with Haskell

More than 5 years have passed since last update.

FizzBuzzをフィボナッチ数列で行うコードをHaskellで書いてみました。
特に意味はないテスト投稿です。

import Control.Monad (forM_)

fib :: [Integer]
fib = 0 : 1 : 1 : [ fib !! (n-2) + fib !! (n-1) | n <- [3..] ]

main :: IO ()
main = forM_ [1..100] $ \i -> do
    putStr $ show i ++ ": "
    print $ fib !! i

表題のwithの使い方合ってるかな…?

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away