2007-10-11から1日間の記事一覧

accumulator generator

http://d.hatena.ne.jp/Nobuhisa/20071009/1191942302 やっぱり大丈夫そうでした。 Func<int, Func<int,int>> foo = ( x => (y => x += y)); var f1 = foo( 0 ); Console.WriteLine( f1( 10 ) ); //10 Console.WriteLine( f1( 10 ) ); //20 Console.WriteLine( f1( 10 ) ); //30</int,>

range

Common LispにはPython等に見られるrange関数がないみたい(?)ですね。 (defun range (end &optional (start 0) &key (step 1)) (cond ((not (plusp (- end start))) nil) (t (let (acc) (do ((i start (+ i step))) ((>= i end) (nreverse acc)) (push i …