Card Sharp
Card Sharp で一位ゲット(237B)。それにしてもひどいコードだ。
puts
OCaml で Ruby の puts もどき。可変個の引数を取る。
$ ocaml -rectypes Objective Caml version 3.09.3 # let rec puts s = print_endline s; puts;; val puts : string -> 'a as 'a = <fun> # puts "foo" "bar";; foo bar - : string -> 'a as 'a = <fun> # puts "one" "two" "three";; one two three - : string -> 'a as 'a = <fun> # puts "xxx"; puts "yyy";; Warning F: this function application is partial, maybe some arguments are missing. xxx yyy - : string -> 'a as 'a = <fun>
-rectypes 使わないといけなかったり ; で繋げると警告出るから嫌だ。
ledit
OCamlの対話環境でヒストリー機能とか色々使いたくなったのでleditを入れる。
ledit-1.11.tar.gz を落としてmake…すればいいはずなのだが、
$ make camlp4r pa_extend.cmo q_MLast.cmo pa_local.ml -o pa_local.ppo File "pa_local.ml", line 34, characters 13-65: use of antiquotation syntax deprecated since version 3.06+18 ocamlc -I `camlp4 -where` -c -impl pa_local.ppo File "pa_local.ml", line 19, characters 0-1: Unbound value _loc make: *** [pa_local.cmo] エラー 2
なんかエラー。OCamlのバージョンの問題? 原因がcamlp4にあるっぽいのでわけわからねえのれす。うぐう。でも "Unbound value _loc" とかでググったりして、勘で expr_of_patt の中の loc を _loc にしてみる。…おお、通った。ledit超便利だ。感動。
欲を言えばirbのクラス名やメソッド名補完みたいなことしたいけど OCaml と ledit が分かれてたら難しいだろうなー