Okada Hiroshi の blog

typo が多いです

Haskell 勉強記録 6 日目

第5章:高階関数 関数プログラマの道具箱の途中まで (位置 1740/11175)読み進めましたが、 いままで結構沢山の関数が登場して覚えきれなくなってきました。

とりあえず、今まで出てきた関数を (だいたい登場順に) 書き出してみることにしました。 まだ途中ですが、明日からも書き出し作業を続けることにしました。

( True || False )      == True
( True && False )      == False
not True               == False
succ 'c'               == 'd'
min 4 5                == 4
max 'a' 'z'            == 'z'
div 92 3               == 30
mod 14 5               == 4
[1,2,3] ++ [4,5]       == [1,2,3,4,5]
'a':" long time"       == "a long time"  
"abcdef" !! 2          == 'c'
( [1,2,3] < [1,2,4] )  == True
( "bbc" > "abc" )      == True
( [1,2,3] <= [1,2,4] ) == True
( "bbc" >= "abc" )     == True
( "abc" == "abc" )     == True
(1.0 /= 1.5)           == True 
head [1..]             == 1
tail [1,2,3]           == [2,3]
init [1,2,3,4]         == [1,2,3]
length ['a'..'z']      == 26
null []                == True
reverse [1,2,3]        == [3,2,1]
take 3 [1..]           == [1,2,3]
drop 7 [1..10]         == [8,9,10]
maximum [1,10,2]       == 10
minimum [3,2,4]        == 2
sum [1,10,100]         == 10
product [2,3,4]        == 24
elem 4 [1,2,3,4,5]     == True
take 10 ( cycle "abc") == "abcabcabca"
take 5 ( repeat 'x')   == "xxxxx"
replicate 5 'x'        == "xxxxx"
odd 5                  == True
even 8                 == True
fst (1,'A')            == 1
snd (1,'A')            == 'A'
zip [1..] "ABC"        == [(1,'A'),(2,'B'),(3,'C')]
show 4.25              == "4.25"
(read "4" :: Int)      == 4 
(minBound :: (Bool, Int, Char))  == (False,-9223372036854775808,'\NUL') 
(maxBound :: (Bool, Int, Char))  == (True,9223372036854775807,'\1114111')
fromIntegral (div 5 3) + 1.5     == 2.5