Scheme

あなごる

久々のgolf期。http://www.shinh.org/reveal.rb?odd+lines/pla/1190383459に感動したってのが大きい。 Smileys Triangle, Mirroring Characterでトップ。あとはよくて1位タイとか。そもそもSchemeのゴルファーってあんまりいないみたいだけど。 アルゴリズム…

Schemeの恒等関数

なんでidが定義されてないんだろう…と思ってたけど、valuesを使うんだな。 ちなみにGaucheにはundocumentedな関数identityがある模様。

"+mzscheme"でVim7をコンパイル・インストール

Vim development : vim online % cvs -z3 -d:pserver:anonymous@cvs.sf.net:/cvsroot/vim checkout vim7Makefileを編集。こんなんでいいのかな。 % diff Makefile.bak Makefile -u --- Makefile.bak 2006-03-01 22:41:39.000000000 +0900 +++ Makefile 2006-…

MzSchemeをインストール

"PLT Scheme", "DrScheme", "MzScheme"と三つの言葉が目に入って混乱した。 PLT Scheme is an umbrella name for a family of implementations of the Scheme programming language. ... DrScheme is the primary PLT Scheme implementation. ... MzScheme i…

8 Queens Problem

SICPにもある問題。Scheme(Gauche)で解くとこんな感じか。 (use srfi-1) (define (safe-pieces? x1 y1 x2 y2) (not (or (= y1 y2) (= (+ x1 y1) (+ x2 y2)) (= (- x1 y1) (- x2 y2))))) (define (safe? pieces new-row) (every (cute safe-pieces? (length p…