Skip to content

Instantly share code, notes, and snippets.

@ikr7
Last active August 29, 2015 14:02
Show Gist options
  • Save ikr7/33cfcdfa35e5ef260e73 to your computer and use it in GitHub Desktop.
Save ikr7/33cfcdfa35e5ef260e73 to your computer and use it in GitHub Desktop.
#LiveScript メモ
#関数定義
add = (x, y) --> x + y
add 5 6 #=> 11
#中置記法
4 `add` 6 #=> 10
#カリー化
add3 = add 3
add3 5 #=> 8
#関数合成
add4 = add 4
add7 = add4 >> add3
add7 10 #=> 17
#パターンマッチ
fact = (n) ->
| n is 0 => 1
| otherwise (fact n - 1) * n
fact 4 #=> 24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment