タグ「関数型言語」のすごいエントリーRss

;;;;; lazy evaluation (def (numbers x) (cons x (numbers (+ x 1)))) (numbers 0) ;;=> (0 1 2 3 4 5 6 7 8 9...) (map (* 5) (numbers 0)) ;;=> (0 5 10 15 20 25 30 35 40 45...) ;;;;; curry ((+ 1) 2) ;;=> 3 ((cons 1) 5) ;;=> (1 . 5) (def a 1) (def (incr1 x) (+ a 1)) (def incr2 (+ a)) (def a 2) (incr1 1) ;;=> 3 (incr2 1) ;;=> 2 (def digits (head (> 10) (numbers 0))) digits ;;=> (0 1 2 3 4 5 6 7 8 9) ;;;;; proceduare composition (def ident (. incr decr incr decr)) (ident 30) ;=> 30 ((. (* 3) (+ 1)) 2) ;;=> 9 ;;;;; ... 続きを読む
1 コメント   このエントリーを含むはてなブックマーク このエントリーのブックマーク数

[PR]これはカワイイ!ブログランキングBITZ