ringtaroのHaskell日記

 | 

2010年01月26日(火)

プログラミングHaskell第2章練習問題をやったよ。 19:18

1.

(2^3)*4
(2*3)+(4*5)
2+(3*(4^5)))

2.実行したよ。

3.

n = a `div` length xs
  where
    a = 10
    xs = [1,2,3,4,5]

・関数名にNは使えないのでnに変更。

・整数の除算演算子は'div'ではなく、`div`。

・a=10のインデント位置を修正。

4.

last1 xs = xs !! (length xs - 1)

last2 xs = head (reverse xs )

5.

init1 xs = take (length xs - 1) xs

init2 xs = reverse (tail (reverse xs))

SultanSultan2013/07/27 02:10That's more than sebilnse! That's a great post!

MonyMony2013/07/28 09:19Furrealz? That's <a href="http://cxxyedpxlu.com">marlslouevy</a> good to know.

JordyJordy2013/07/28 17:11You've hit the ball out the park! Inciedrble! http://ihocbuqlc.com [url=http://gnhqrzkf.com]gnhqrzkf[/url] [link=http://sxlswxtrqh.com]sxlswxtrqh[/link]

KimKim2013/07/30 21:21I hate my life but at least this makes it <a href="http://awofnoevyb.com">bealabre.</a>

 |