学習ログ
Infix Functions
-- Plus.hs a `plus` b = a + b
*Main> plus 3 4 7 *Main> 4 `plus` 5 9
語順がかえられる。
infix
# infix
【名】《言語学》接中辞{せっちゅうじ}、挿入辞{そうにゅう じ}◆ある形態素の中に挿入される接辞。タガログ語などのオーストロアジア語族に特徴的な言語要素。英語ではヒップホップ・スラングのiz(houseがhizousになる)などのわずかな例が知られている。
【他動】
1. 〔しっかりと〜を〕挿入{そうにゅう}する、固定{こてい}する、取り付ける
・Two crystal balls are infixed in a gold crown. : 二つの水晶玉が金の王冠に取り付けられている。
2. 〔人の心に〜を〕教え込む、吹き込む
3. 《言語学》〔語に接中辞{せっちゅうじ}を〕挿入{そうにゅう}する
Safely and Sanely Working with Crashy Functions
-- EfficientList.hs myDumbExample xs = if length xs > 0 then head xs else 0 mySmartExample xs = if not (null xs) then head xs else 0 myOtherExample (x:_) = x myOtherExample [] = 0
*Main> :load ./EfficientList.hs [1 of 1] Compiling Main ( EfficientList.hs, interpreted ) Ok, modules loaded: Main. *Main> myDumbExample [1..] ^CInterrupted. *Main> mySmartExample [1..] 1 *Main> myOtherExample [1..] 1
lengthは、infiniteに弱いので良くない戦略。別の戦略がベター。
単語めも:infinite
【名】
1. 〔数量{すうりょう}・程度{ていど}などが〕無限{むげん}のもの
2. 《数学》無限大{むげんだい}
3. 《the 〜》無限{むげん}(の)空間{くうかん}
4. 《the Infinite》神
Real World Haskell: Code You Can Believe In
- 作者: Bryan O'Sullivan,John Goerzen,Donald Bruce Stewart
- 出版社/メーカー: O'Reilly Media
- 発売日: 2008/12/05
- メディア: ペーパーバック
- 購入: 2人 クリック: 78回
- この商品を含むブログ (40件) を見る