2013年11月1日金曜日

開発環境

C実践プログラミング 第3版 (Steve Oualline (著)、 望月 康司 (監訳) (翻訳)、谷口 功 (翻訳)、オライリー・ジャパン)のⅡ部(単純なプログラミング)の10章(Cプリプロセッサ)、10.1(#define文)、設問 10-2をHaskellで解いてみる。

その他参考書籍

設問 10-2.

コード(BBEdit)

Sample.hs

{-# OPTIONS -Wall -Werror #-}

main :: IO ()
main = putStr $ concat $ replicate myMax "Hi there\n"

myMax :: Int
myMax = 10

入出力結果(Terminal, runghc)

$ runghc Sample.hs
Hi there
Hi there
Hi there
Hi there
Hi there
Hi there
Hi there
Hi there
Hi there
Hi there
$

{-# OPTIONS -Wall -Werror #-}を記述してるから、細かく型を指定(:: Double)しないと警告がいっぱい出た。慣れるまでは{-# OPTIONS -Wall -Werror #-}の記述を消さずに細かく型を指定していくことに。

0 コメント:

コメントを投稿