2009-01-01から1ヶ月間の記事一覧

デフォルトブロックはまだか!引数の話

def f(&b=proc{|x| x }) b end 予想はしてたけど,こんな感じのことはどうやら書けない. -:1: syntax error, unexpected '=', expecting ')' def f(&b=proc{|x| x }) ^そこで,こうした. def f(&b) b ||= proc {|x| x } end 引数といえば,引数が0個の時と…

標準入力ポートを閉じてみた

gosh> (close-input-port (standard-input-port)) #<undef> gosh> *** IO-CLOSED-ERROR: I/O attempted on closed port: #<iport(closed) (stdin) 0x9db40> Stack Trace: _______________________________________ gosh> *** IO-CLOSED-ERROR: I/O attempted on closed port: #<iport(closed) (stdin) 0x9db40> Stack Trace…</iport(closed)></iport(closed)></undef>

scheme-completeの設定を修正した

うまく動いていると思ったのだが,composeを使おうとして,補完がうまくできないことに気付く.R5RSとsrfiの範囲は補完できるようだ.ぐぐってみると,ChickenとGaucheには対応しているらしい.しかしEmacsの設定ファイルにはちゃんと設定をコピペしてある.…

Schemeで補完始まった

Scheme 補完 でぐぐったら出てきたのがここ↓ 汝の隣人のブログを愛せよ | LOVELOGこれは始まった! でもこれだと,行頭以外でインデントを直せないので,eval-after-loadに一行追加してみた. (define-key scheme-mode-map [(control tab)] 'lisp-indent-lin…

Maximum Cyclic Segment Sum

初単独一位とった. もう1byte縮められるんだけど,timeoutで通らない…入れたやつも,通ったり通らなかったりして際どかった. 最近,ちょっと上位陣に近づいてきた気がする.気のせいかもしれんけど. 以下ネタバレ.

代数的データ型がほしくて

作った. # 前略 Maybe = algebraic(:nothing, :just, Object) def foo(y) puts match(y) { _(:just) {|x| "Just #{x}" } _ { "Nothing" } } end foo Maybe.new(:just, 42) foo Maybe.new(:nothing) Just 42 NothingCool!