2007-06-29から1日間の記事一覧

wikiを書いてみた。

始めた書いたlispのアプリケーション。 それにしてはlispにみえない。苦労したのはファイル周り。読み込み (define contents (call-with-input-file #`"wiki/,title" (lambda (x) (if x (port->string x) "")) :if-does-not-exist #f))書き出し (with-output…

その2

少し短くなった。 $ gosh -e '(for-each (lambda (x) (display (call-with-input-file x port->string))) *argv*)' a.txt b.txt foo bar buzz foo2 bar2 buzz2

だめ、俺の限界を超えてる。モナド来た しかも引数0の時動かない。 $ runghc -e 'import System;main=do{a<-getArgs;mapM (\x->getFile x) a;return ()};getFile x=do{c<-readFile x;putStr c} ' a.txt b.txt foo bar buzz foo2 bar2 buzz2 もう少し読みや…

functionでaliasを実装する。

unsetじゃ駄目だったんだ。 $ function ls { unset ls; echo "This is ls";ls; }; ls ;declare -f ls This is ls gosh_wrap gosh_wrap.clsが消えてしまっている。別の関数を使えば以下のように解決できる。でもかっこわるい。 $ function ls { ls2; } ; func…