Created
January 28, 2010 13:18
-
-
Save kosh04/288728 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/sbcl --script | |
;;; Usage: | |
;; | |
;; $ sbcl --script play.lisp --play hige:pon | |
;; or | |
;; $ clisp play --play hige:pon | |
(require :asdf) | |
(push (merge-pathnames "code/lisp/drakma-1.1.0/" (user-homedir-pathname)) asdf:*central-registry*) | |
;; FIXME: ロード中のoutputを非表示に出来ないものか | |
(asdf:oos 'asdf:load-op :drakma) | |
(asdf:oos 'asdf:load-op :scheme_baton) | |
(defvar *main-args* | |
#+clisp ext:*args* | |
#+sbcl sb-ext:*posix-argv* | |
"LISPの起動引数.") | |
(labels ((getopt (arg &optional valuep) | |
(let ((pos (position arg *main-args* :test #'string-equal))) | |
(if (and pos valuep) | |
(nth (1+ pos) *main-args*) | |
(integerp pos))))) | |
;; 引数指定に柔軟さがない件 | |
(case (intern (getopt "--play" t)) | |
(|hige:pon| (hige:pon)) | |
(|hige:pin| (hige:pin)) | |
(|hige:pun| (hige:pun)) | |
(|hige:pen| (hige:pen)) | |
;; ... | |
) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; Scheme コードバトン (CL fork) 個人メモ | |
;;; | |
;;; Source: http://gist.github.com/286831 | |
;;; | |
#| | |
やってみたこと | |
============== | |
* ちまちま添削 | |
* sbcl+ubuntu+slime で動作確認 (clispも一応) | |
* 空のエントリを登録しないようにした (add `empty-entry-p') | |
* ソースコードとは別に下書き用ファイルを作成、githubに貼り付け (このファイル) | |
* ログファイルもディレクトリがない場合は作成するように | |
* スクリプト実行の出来る処理系用のコードも欲しかったかなー | |
やろうとして結局手つかずになったもの | |
==================================== | |
* ローカルファイルとURIファイルは | |
(string= "http://" path :end2 7) | |
で判別すれば:URIキーワードで分けずに済みそう | |
* ファイル判別を自動を勝手にしてくれるように (:http?) | |
* 単語の再定義を上書きするかどうか | |
導入メモ | |
======== | |
導入していなかったライブラリをapt-get経由でインストール | |
(cl-usocket,cl-plus-ssl,cl-chunga) | |
drakmaはパッケージがなかったので、http://weitz.de/drakma/から最新版を | |
インストール...したのはいいけど実行不可orz | |
(drakma:http-request "http://www.lisp.org") | |
;-> unknown &KEY argument: :NODELAY | |
** 一応起動はするのでdrakmaまわりの関数は避けて動作確認をしました。 | |
思ったこと | |
========== | |
このコードバトン企画、ソースコードが増えることを考慮すると最初の参加者と | |
最後の参加者が同じ2日間であれこれするには後者は時間が足りなくなるような | |
...と思ったが、前々の人のforkを予習しておけば問題ないか | |
y-or-n-p 関数のプロンプトに "...(y or n)[yn]" と表示されるのは冗長? | |
テスト環境も欲しいよね | |
次回はgit(GitHub)のバージョン管理方式でバトンを渡すとか | |
ただし、gitの基礎知識が必要になるので多少敷居が上がるのが玉にキズかも | |
|# | |
;;; 下書き用 | |
;; インストール | |
(asdf:oos 'asdf:load-op :scheme_baton) | |
;=> NIL | |
; or M-x slime-load-system [scheme_baton] | |
(in-package :hige) | |
(documentation 'setup-dict 'function) | |
;=> "Setup a dictionary for quiz; | |
;maybe read data from a file and apply fn to the dictionary." | |
(read-dict *dict-file*) | |
;; => ((|heap| "積み重ねた物" 2 1) (|defect| "欠点" 2 1) (|lisp| "舌足らずな" 2 0) | |
;; (|exploration| "探査、探検" 2 0)[ (|errand| "使いっ走り" 2 0) | |
;; (|allowance| "割当量" 2 0)) | |
(make-instance 'dict :entries nil) | |
;=> #<dict: entries: 0 total/ok/NG: 0/0/0> | |
(make-instance 'dict :entries (read-dict *dict-file*)) | |
;=> #<dict: entries: 13 total/ok/NG: 20/17/3> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment