<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-261310295976223518</id><updated>2012-02-17T01:26:52.017+09:00</updated><category term='mtools'/><category term='酒'/><category term='McCLIM'/><category term='Python'/><category term='cl-glfw'/><category term='居酒屋'/><category term='cl-dot'/><category term='神社'/><category term='酒屋'/><category term='C'/><category term='アセンブラ'/><category term='cl-annot'/><category term='Modula-3'/><category term='Clojure'/><category term='EmacsLisp'/><category term='x86'/><category term='ログメモ'/><category term='温泉'/><category term='help'/><category term='VOP'/><category term='Test'/><category term='CommonLisp'/><category term='GUI'/><category term='C++'/><category term='ネタ'/><category term='Eamcs'/><category term='GRUB'/><category term='GCC'/><category term='PostScript'/><category term='リーダーマクロ'/><category term='PowerShell'/><category term='書籍'/><category term='cl-gtk2'/><category term='日本酒'/><category term='mochiweb'/><category term='旅行'/><category term='QEMU'/><category term='SBCL_Internals'/><category term='cl-yacc'/><category term='Android'/><category term='Scheme'/><category term='本日の酒'/><category term='ELisp'/><category term='CommonQt'/><category term='linux'/><category term='Python PythonImagingLibrary'/><category term='Modula3'/><category term='Go'/><category term='zpb-ttf'/><category term='PCI'/><category term='; CommonLisp'/><category term='PythonImageLibrary'/><category term=': CommonLisp'/><category term='マクロ'/><category term='マシンイプシロン'/><category term='Lions&apos; Commentary on UNIX'/><category term='cl-gd'/><category term='F#'/><category term='Racket'/><category term='CLOS'/><category term='Clack'/><category term='テスト'/><category term='SBCL'/><category term='Package'/><category term='GrayStream'/><category term='GDB'/><category term='Ruby'/><category term='DB'/><category term='cl-ppcre'/><category term='ジンジャーエール'/><category term='Emacs'/><category term='HyperSpecを読んでみる'/><category term='正規表現'/><category term='Automaton'/><category term='LISP'/><category term='OS'/><category term='Erlang'/><title type='text'>プログラマ未満</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default?start-index=101&amp;max-results=100'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>205</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-5359584082652167450</id><published>2012-02-17T01:08:00.006+09:00</published><updated>2012-02-17T01:26:52.031+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><category scheme='http://www.blogger.com/atom/ns#' term='help'/><category scheme='http://www.blogger.com/atom/ns#' term='Scheme'/><category scheme='http://www.blogger.com/atom/ns#' term='Ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><category scheme='http://www.blogger.com/atom/ns#' term='Clojure'/><category scheme='http://www.blogger.com/atom/ns#' term='Racket'/><title type='text'>処理系に質問する方法</title><summary type='text'>いろいろなプログラミング言語を利用していると、同じような機能の関数の名前が言語間で異なることがしばしばあります。ブラウザを立ち上げてドキュメントを探して、としても良いかもしれませんが、ちょっとど忘れした名前を調べるだけならば、使っている処理系に問いあわせるだけで目的を達成できそうです。ということで、各処理系でのヘルプ機能を調べてみました。RubyRubyのオブジェクトにはメソッドやメンバ変数の一覧を取得するメソッドが備わっています。methods メソッドを返すpublic_methods publicなメソッドを返すprivate_methods privateなメソッドを返すprotected_methods protectedなメソッドを返すinstance_methods メソッドを返すincluded_modules インクルードしているモジュールを返すconstants </summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/5359584082652167450/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2012/02/blog-post.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5359584082652167450'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5359584082652167450'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2012/02/blog-post.html' title='処理系に質問する方法'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-7656248697960979886</id><published>2012-02-13T23:45:00.002+09:00</published><updated>2012-02-13T23:48:52.746+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DB'/><category scheme='http://www.blogger.com/atom/ns#' term='Racket'/><title type='text'>RacketでSQLite3</title><summary type='text'>RacketでDBアクセスを行ってみます. Windows版だとインストールしただけでSQLite3が使えるようです.#lang racket(require (prefix-in db: db))(define con  (db:sqlite3-connect   #:database "sqlte3-test"   #:mode 'create))(define (create-table con)  (db:query-exec   con   "create table kv(key text, value text)"))(define (insert-values con)  (let ((q (db:prepare     con     "insert into kv(key, value) values($1, $2)")))    (db:query-exec con</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/7656248697960979886/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2012/02/racketsqlite3.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/7656248697960979886'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/7656248697960979886'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2012/02/racketsqlite3.html' title='RacketでSQLite3'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-4752882735762072806</id><published>2012-01-28T01:16:00.002+09:00</published><updated>2012-01-28T01:18:58.773+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Scheme'/><category scheme='http://www.blogger.com/atom/ns#' term='Racket'/><title type='text'>Racketでファイル名入力ダイアログ</title><summary type='text'>get-file関数でファイル名入力ダイアログを利用できます.戻り値はパスまたは#fです.オブジェクト指向風にファイル名入力用テキストフィールド+ボタンをまとめたクラスを作成してみます.#lang racket(require racket/gui/base)(define file-input-pane%  (class vertical-pane%    (init-field button-label)    (init-field parent)    (init-field [label #f])    (super-new [parent parent]               [stretchable-height #f]               [stretchable-width #f])    (when label      (new message% [</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/4752882735762072806/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2012/01/racket_28.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/4752882735762072806'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/4752882735762072806'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2012/01/racket_28.html' title='Racketでファイル名入力ダイアログ'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-1513305975582302862</id><published>2012-01-25T00:32:00.002+09:00</published><updated>2012-01-25T00:34:57.351+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Scheme'/><category scheme='http://www.blogger.com/atom/ns#' term='Racket'/><title type='text'>Racketで画像作成(racket/draw)</title><summary type='text'>Racketで画像を作成します.いくつか手段がありそうですが、racket/drawを利用します.フォントを指定すれば日本語も出力できるようです.#lang racket(require racket/draw)(define target (make-bitmap 150 30))(define dc (new bitmap-dc% [bitmap target]));; 長方形(send dc draw-rectangle 1 1 149 29);; フォントの設定(define ms-font (make-object font% 10 "ＭＳ ゴシック" 'default))(send dc set-font ms-font);; 文字列(send dc draw-text "こんにちはせかい" 5 10);; 保存(send target save-file "</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/1513305975582302862/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2012/01/racketracketdraw.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/1513305975582302862'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/1513305975582302862'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2012/01/racketracketdraw.html' title='Racketで画像作成(racket/draw)'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-8069297072012893572</id><published>2012-01-25T00:09:00.003+09:00</published><updated>2012-01-25T00:21:37.924+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Scheme'/><category scheme='http://www.blogger.com/atom/ns#' term='Racket'/><title type='text'>Racketでコマンドライン引数のパース</title><summary type='text'>Racketにはコマンドライン引数をパースするための機能が備わっているようです.ためしに簡易catコマンドを作ってみます.#lang racket(define line-number? #f)(define files  (command-line   #:program "cat"   #:once-each   (("-n" "--number") "show line number"                      (set! line-number? #t))   ;; 残りの引数.command-lineの戻り値になる.   #:args args args))(define output-lines  (if line-number?      (lambda (port)        (define n 1)        (for ((line (</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/8069297072012893572/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2012/01/racket.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/8069297072012893572'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/8069297072012893572'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2012/01/racket.html' title='Racketでコマンドライン引数のパース'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-9164419312342609943</id><published>2012-01-20T00:49:00.001+09:00</published><updated>2012-01-20T00:55:57.441+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Scheme'/><category scheme='http://www.blogger.com/atom/ns#' term='GUI'/><category scheme='http://www.blogger.com/atom/ns#' term='Racket'/><title type='text'>Racket(Scheme)でGUI</title><summary type='text'>Racketでウィンドウを表示し、線を引いてみます. "draw"ボタンをクリックするたびにランダムな色と位置で線が表示されます.#lang racket(require racket/gui/base         srfi/27)(define frame  (new frame%       [label "Example"]       [width 300]       [height 300]))(define cvs (new canvas% [parent frame]))(define pen-styles  '(transparent solid xor hilite dot long-dash                short-dash dot-dash xor-dot                xor-long-dash xor-short-dash</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/9164419312342609943/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2012/01/racketschemegui.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/9164419312342609943'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/9164419312342609943'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2012/01/racketschemegui.html' title='Racket(Scheme)でGUI'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-5610899937920911656</id><published>2012-01-19T01:24:00.002+09:00</published><updated>2012-01-20T00:56:35.792+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Scheme'/><category scheme='http://www.blogger.com/atom/ns#' term='Racket'/><title type='text'>Racket(Scheme)でWebサーバ+formlets</title><summary type='text'>RacketでWebサーバ+formletsを使ってみます。以下のコードで、ローカルホストの8000ポートでWebサーバが立ち上がります。#lang racket(require  web-server/servlet  web-server/servlet-env  web-server/dispatch  web-server/formlets)(define-values (dispatcher _) (dispatch-rules  [("input") show-input]  [("output") show-output]  [else show-default]))(define form (formlet  (div "input:" ,{=&gt; input-string input})  input))(define (show-input req) (response</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/5610899937920911656/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2012/01/racketschemewebformlets.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5610899937920911656'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5610899937920911656'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2012/01/racketschemewebformlets.html' title='Racket(Scheme)でWebサーバ+formlets'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-1768585046034328325</id><published>2011-12-23T02:50:00.002+09:00</published><updated>2011-12-23T02:55:22.813+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Eamcs'/><title type='text'>package.elのレポジトリの構成</title><summary type='text'>Emacs 24から標準でついてくるとどこかで耳にしたpackage.elを眺めました。簡単そうだったので、ためしにgithubにレポジトリを作ってみました。</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/1768585046034328325/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2011/12/packageel.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/1768585046034328325'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/1768585046034328325'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2011/12/packageel.html' title='package.elのレポジトリの構成'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-6938588499401099227</id><published>2011-11-16T23:41:00.001+09:00</published><updated>2011-11-16T23:41:56.812+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mochiweb'/><category scheme='http://www.blogger.com/atom/ns#' term='Erlang'/><title type='text'>MochiWebで学ぶErlang(mochiweb_http)</title><summary type='text'>はじめにMochiWebはErlangで書かれた軽量HTTPサーバーです。Erlang使いを志すならMochiWebのコードを読むと良いらしいので読んでみます。MochiWebはMITライセンスのようです。HTTPサーバーの起動はmochiweb_httpモジュールのstart関数により行います。なので、mochiweb_httpから順に流れを追ってみます。mochiweb_http.erlは単体テストを入れて250行程度。ファイルの先頭部分参考http://www.erlang.org/doc/reference_manual/modules.htmlhttp://www.erlang.org/doc/reference_manual/macros.htmlhttp://d.hatena.ne.jp/m-hiyama/20070922/1190432025%% @author Bob </summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/6938588499401099227/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2011/11/mochiweberlanghttp-erlangmochiweb.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/6938588499401099227'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/6938588499401099227'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2011/11/mochiweberlanghttp-erlangmochiweb.html' title='MochiWebで学ぶErlang(mochiweb_http)'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-7134376770865952494</id><published>2011-11-10T00:08:00.001+09:00</published><updated>2011-11-10T00:08:56.409+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Erlang'/><title type='text'>Erlang+TCP</title><summary type='text'>Erlangã§TCPãµã¼ããæ¸ãã¦ã¿ã¾ããã­ã¼ã«ã«ãã­ã­ã·ãä½ã£ã¦ã¿ããã§ãã-module(serv).-compile(export_all).-compile([start/1]).-define(TCP_OPTIONS, [binary, {packet, raw}, {active, false}, {reuseaddr, true}]).start (Port) -&gt;    spawn(?MODULE, init, [Port, self()]).init(Port, Pid) -&gt;    {ok, Listen} = gen_tcp:listen(Port, ?TCP_OPTIONS),    accept_loop(Listen, Pid).</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/7134376770865952494/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2011/11/erlangtcp.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/7134376770865952494'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/7134376770865952494'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2011/11/erlangtcp.html' title='Erlang+TCP'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-4477079980129759078</id><published>2011-10-27T02:17:00.001+09:00</published><updated>2011-10-27T02:17:58.928+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C'/><title type='text'>自力で末尾再帰をループにしてみた ver C</title><summary type='text'>コールスタックについて理解するためにスタックをいじって遊んでみました。C言語で末尾再帰関数を呼び出す際にスタックを使い果たさないようにしてみます。もっとも、gccだと-O2を付けてコンパイルすると最適化がかかって勝手にループになるみたいではありますが。関数呼び出し後のスタックに積まれている値とesp,ebpの値は以下のようになるらしいです。 ...ebp + 8 : 第1引数ebp + 4 : リターンアドレスebp + 0 : 呼び出し元でのebpの値ebp - 4 : ローカル変数...ebp - x : ローカル変数このへん &lt;- ESPバッファオーバーフローやoff-by-oneエラーではreturn時に復帰するリターンアドレス(returnする際に移るアドレスを変える)や呼び出し元のebp(呼び出し元関数がreturnする際に移るアドレスを変える)を書き換えることで</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/4477079980129759078/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2011/10/ver-c.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/4477079980129759078'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/4477079980129759078'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2011/10/ver-c.html' title='自力で末尾再帰をループにしてみた ver C'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-5238625227203822723</id><published>2011-10-20T00:02:00.001+09:00</published><updated>2011-10-20T00:02:26.036+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Eamcs'/><title type='text'>Emacsのヘルプ</title><summary type='text'>Emacsに助けを求めるためのコマンド。apropos,find-functionあたりはよく使ってます。 情報を表示する describe-ほげほげコマンド。色々な情報を表示してくれます。たくさんありそうなのでEmacsLispを書くときに使いそうなものを列挙。- describe-bindings  キーシーケンスのコマンド(Anythingが入ってると一覧表示してくれる) - describe-function  指定した関数の情報 - describe-variable  指定した変数の情報 - describe-char      カーソル位置にある文字の情報(文字コードなど) 定義場所を探す Emacs Lispの関数や変数が定義された場所を探すコマンド。- find-function             指定した関数の定義された場所に飛ぶ - </summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/5238625227203822723/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2011/10/emacs.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5238625227203822723'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5238625227203822723'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2011/10/emacs.html' title='Emacsのヘルプ'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-1627813836345152082</id><published>2011-10-19T23:29:00.001+09:00</published><updated>2011-10-19T23:29:01.428+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Emacs'/><title type='text'>同じ単語(シンボル)をハイライト表示する(マイナーモード版)</title><summary type='text'>最近LispといえばEmacsLispしか触っていません。この間書いたカーソル位置の単語と同じ単語をハイライト表示する機能をマイナーモードにしてみました。コードはgithubに置きました。 (require 'hl-same-symbol-mode);; emacs-lisp-modeで有効にしたい場合(add-hook 'emacs-lisp-mode-hook 'hl-same-symbol-mode);; ハイライトするまでのアイドル時間を変更する(setf hl-same-symbol-delay 0.10);; ハイライトの表示を変更する(setf hl-same-symbol-face '何か)</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/1627813836345152082/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2011/10/blog-post_19.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/1627813836345152082'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/1627813836345152082'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2011/10/blog-post_19.html' title='同じ単語(シンボル)をハイライト表示する(マイナーモード版)'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-5810482833945004046</id><published>2011-10-13T09:00:00.001+09:00</published><updated>2011-10-13T09:00:40.075+09:00</updated><title type='text'>同じ単語(シンボル)をハイライト表示する</title><summary type='text'>EmacsのOverlayを使ってみるテスト。カーソル位置にある単語(symbol-at-pointで取得できるもの)と同じ単語をハイライト表示させます。show-paren-modeみたいにタイマーを使ったほうが良いかも。 (eval-when-compile (require 'cl))(defvar *hl-same-symbol::text* "")(defvar *hl-same-symbol::list* nil)(defvar hl-same-symbol-face 'highlight)(defun hl-same-symbol::highlight (text)  (setf *hl-same-symbol::text* text)  ;; (highlight-regexp (regexp-quote text) hl-same-symbol-face)  (let </summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/5810482833945004046/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2011/10/blog-post.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5810482833945004046'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5810482833945004046'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2011/10/blog-post.html' title='同じ単語(シンボル)をハイライト表示する'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-2558966226324136741</id><published>2011-10-05T00:19:00.001+09:00</published><updated>2011-10-05T00:19:12.656+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Emacs'/><title type='text'>popup.elで右クリックのようななにか</title><summary type='text'>popup.elでコマンドメニューを表示させてみます。 (require 'popup)(defvar *rclick-command-tree*)(setf *rclick-command-tree*      `(	[org-capture "org-capture" (lambda () (featurep 'org))]	("Erlang"	 [:major-mode erlang-mode]	 [run-erlang "run-erlang-shell"])	("Org"	 [:feature org]	 [org-sparse-tree "org-sparse-tree"]	 [org-schedule "org-schedule"]	 [org-deadline "org-deadline"]	 [org-time-stamp "org-time-stamp"])	("VC</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/2558966226324136741/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2011/10/popupel.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/2558966226324136741'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/2558966226324136741'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2011/10/popupel.html' title='popup.elで右クリックのようななにか'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-2401745742434864765</id><published>2011-09-18T01:24:00.002+09:00</published><updated>2011-09-18T01:28:47.251+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ELisp'/><title type='text'>popup.elで遊んでみる</title><summary type='text'>overlayを使ってポップアップメニューを表示するpopup.elを使ってみました。rclk:rclkコマンドを実行すると、*rckl:clauses*に設定されている条件にしたがってメニューを表示します。右クリックをイメージしています。;; (require 'popup)(defvar *rclk:clauses* nil)(defvar *rclk:format-function* nil)(defun rclk:rclk ()(interactive)(rclk:popup-menu*(rclk:select *rclk:clauses*)))(defun rclk:clause-name (clause)(if (&lt;= (length clause) 2)   (second clause) (third clause)))(defun rclk:select (</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/2401745742434864765/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2011/09/popupel.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/2401745742434864765'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/2401745742434864765'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2011/09/popupel.html' title='popup.elで遊んでみる'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-2731590307495147456</id><published>2011-08-29T23:18:00.000+09:00</published><updated>2011-08-29T23:19:40.001+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PowerShell'/><title type='text'>Windows Power Shell で Word の表に書き込む</title><summary type='text'>大量のWordやExcelファイルを一括で処理する方法が知りたいです。とりあえず、Power Shell で頑張るための第一歩。既存のファイルを開いて、Word中の表の(1,1)に文字列を挿入します。$w = New-Object -ComObject "Word.Application"$d = $w.Documents.open("filename")$d.Tables.Item(1).Cell(1,1).Range.Text = "hoge"1日の間に更新されたファイルをカレントディレクトリ以下から探します。$d = (date).AddDays(-1)Get-ChildItem -Recurse | Where-Object { $_.LastWriteTime -gt $d }</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/2731590307495147456/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2011/08/windows-power-shell-word.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/2731590307495147456'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/2731590307495147456'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2011/08/windows-power-shell-word.html' title='Windows Power Shell で Word の表に書き込む'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-4389493283091620131</id><published>2011-08-14T01:28:00.002+09:00</published><updated>2011-08-14T01:32:49.121+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='F#'/><title type='text'>F#でキーボードフック</title><summary type='text'>C#でできるらしいので、F#でもできるだろうということでやってみました。.Net上の言語でキーボードフックしてるプログラムを載せてる色々なWebページを参考にしました。F#のコンソールにコピペしてhook_start関数を実行すると,PrintScreenをフックするようになります。open Systemopen System.Diagnosticsopen System.Runtime.InteropServices[&lt;Literal&gt;]let WH_KEYBOARD_LL = 13[&lt;Literal&gt;]let HC_ACTION = 0[&lt;Literal&gt;]let WM_KEYDOWN = 0x0100[&lt;Literal&gt;]let WM_KEYUP = 0x0101[&lt;Literal&gt;]let WM_SYSKEYDOWN = 0x0104</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/4389493283091620131/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2011/08/cf.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/4389493283091620131'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/4389493283091620131'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2011/08/cf.html' title='F#でキーボードフック'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-1683413428946322069</id><published>2011-07-03T22:51:00.001+09:00</published><updated>2011-07-03T22:51:47.572+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Emacs'/><title type='text'>Emacsのコマンド2</title><summary type='text'>1つのキーストロークに複数コマンドを割り当ててみる試みその2。変数の真偽に応じて2種類のうちどちらかの動作をするコマンドを作成しました。 (require 'cl)(defvar *toggle-command-flag* nil)(defun toggle-command-flag ()  (interactive)  (setf *toggle-command-flag*	(not *toggle-command-flag*)))(defun parse-body (body)  (let (fst scd rest)    (setf fst (car body)	  scd (cadr body)	  rest (cddr body))    (unless (stringp fst)      (when scd (push scd rest))      (setf scd </summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/1683413428946322069/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2011/07/emacs2.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/1683413428946322069'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/1683413428946322069'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2011/07/emacs2.html' title='Emacsのコマンド2'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-9207944218567739189</id><published>2011-06-30T00:12:00.001+09:00</published><updated>2011-06-30T00:12:29.306+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Emacs'/><title type='text'>Emacsのコマンド</title><summary type='text'>貴重なC-a,C-eといったキーが行頭/行末移動しかしないのはもったいない、ということで、 sequential-command.elなどのように、多少空気を読んで動作を変えるようなコマンドを定義します。 (defmacro as-this-command (cmd &amp;rest args)  `(progn     (setq this-command ',cmd)     (call-interactively ',cmd ,@args)))(defun buffer-empty? ()  (= (point-min) (point-max)))(defun initialize-buffer ()  (interactive)  (call-interactively 'auto-insert))(defun at-line-start? ()  (= (point) (</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/9207944218567739189/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2011/06/emacs.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/9207944218567739189'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/9207944218567739189'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2011/06/emacs.html' title='Emacsのコマンド'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-803811762964591600</id><published>2011-06-15T01:57:00.001+09:00</published><updated>2011-06-15T01:57:59.725+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><category scheme='http://www.blogger.com/atom/ns#' term='cl-gtk2'/><title type='text'>cl-gtk2 + Glade</title><summary type='text'>cl-gtk2はgladeで作成したファイルを利用できるようなので遊んで見ました。ソースコード (asdf:load-system :cl-gtk2-glib)(asdf:load-system :cl-gtk2-gdk)(asdf:load-system :cl-gtk2-cairo)(asdf:load-system :closure-html)(asdf:load-system :cxml-stp)(asdf:load-system :drakma)(asdf:load-system :cl-ppcre)(asdf:load-system :cl-interpol)(defpackage :gtk-user  (:use :cl)  (:export run))(in-package :gtk-user)(cl-interpol:enable-interpol-syntax)(</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/803811762964591600/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2011/06/cl-gtk2-glade.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/803811762964591600'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/803811762964591600'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2011/06/cl-gtk2-glade.html' title='cl-gtk2 + Glade'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-8425691545103540326</id><published>2011-06-11T15:22:00.001+09:00</published><updated>2011-06-11T15:22:57.594+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><title type='text'>ネタ言語 primefu*k</title><summary type='text'>ネタ言語を実装しました。 ;; 素数リストの作成(defun make-prime-list (n)  (let ((arr (make-array n :initial-element 0 :element-type '(integer 0 1))))    (setf (aref arr 0) 1)    (setf (aref arr 1) 1)    (loop       :for i from 2 below n       :when (zerop (aref arr i))       :do (loop	      :for j from (* i 2) below n by i	      :do (setf (aref arr j) 1)))    (loop       :for i from 0 below n       :when (zerop (aref </summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/8425691545103540326/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2011/06/primefuk.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/8425691545103540326'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/8425691545103540326'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2011/06/primefuk.html' title='ネタ言語 primefu*k'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-3922349232195399223</id><published>2011-06-10T00:31:00.001+09:00</published><updated>2011-06-10T00:31:57.517+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><title type='text'>いまさら Arc Challenge を考える</title><summary type='text'>時代は継続らしいので、cl-contを利用してこんな感じで書いてみます。 (defvar top-page (load-html #p"top.html"))(defvar link-page (load-html #p"link.html"))(defvar result-page (load-html #p"result.html"))(defapp arc (state) (show top-page state) (let ((text state.reply$text))  (show link-page state)  (show result-page state `(:text ,text))))(start #'arc)</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/3922349232195399223/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2011/06/arc-challenge.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/3922349232195399223'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/3922349232195399223'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2011/06/arc-challenge.html' title='いまさら Arc Challenge を考える'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-8229957190841598399</id><published>2011-06-09T02:23:00.001+09:00</published><updated>2011-06-09T02:23:26.526+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><title type='text'>defclassとdefmethodをいじくる</title><summary type='text'>特定のシンボルを特別扱いして、省略表記として利用できるような defclassとdefmethodを定義してみました。似たようなネタばかりやっている気がします。 (asdf:load-system :alexandria);; セッターとゲッター(defgeneric get-slot (obj slot))(defgeneric set-slot (obj slot new))(defmethod get-slot (obj slot)  (slot-value obj slot))(defmethod set-slot (obj slot new)  (setf (slot-value obj slot) new))(defmethod (setf get-slot) (new obj slot)  (set-slot obj slot new))(defgeneric </summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/8229957190841598399/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2011/06/defclassdefmethod.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/8229957190841598399'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/8229957190841598399'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2011/06/defclassdefmethod.html' title='defclassとdefmethodをいじくる'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-4166021178549987416</id><published>2011-06-07T02:49:00.001+09:00</published><updated>2011-06-07T02:49:25.842+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='; CommonLisp'/><category scheme='http://www.blogger.com/atom/ns#' term='ネタ'/><title type='text'>Common Lispは自由過ぎてわかりづらいという思い</title><summary type='text'>ブログがソースコード貼り付け場所と化しているので、文章を書く努力。推測とか感覚とかなんとなくがミックスされてるので文章としてどうなんだろう。 本文 Common Lispは数多くあるプログラミング言語の中でも、自由度という点では(大量の括弧を気にしなければ)トップクラスの言語ではないかと思います。例えば、Common Lispには、プログラマが手を加えることのできる処理のタイミングが3つあります。 1つ目は普通に処理が実行される時、2つ目はコンパイル時(マクロ(※1)/コンパイラマクロ)、3つ目は読み込み時です。多くの言語では、2つ目と3つ目の処理に手を加える機能は存在しないか、限定的なものです。また、Common Lispでは、プログラマが望むならば、大抵のものは自分で作成できます。組み込みのオブジェクトシステム(CLOS)が気にくわなければ、新しいオブジェクトシステムを作成して組み込</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/4166021178549987416/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2011/06/common-lisp.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/4166021178549987416'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/4166021178549987416'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2011/06/common-lisp.html' title='Common Lispは自由過ぎてわかりづらいという思い'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-416622683526228004</id><published>2011-06-04T00:32:00.001+09:00</published><updated>2011-06-04T00:32:55.530+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><category scheme='http://www.blogger.com/atom/ns#' term='Clack'/><category scheme='http://www.blogger.com/atom/ns#' term='cl-annot'/><title type='text'>リクエストパラメータを引数として扱う</title><summary type='text'>HTTPの説明の際に、URLを関数、リクエストパラメータを引数と例えることがあるようなので、実際に引数=リクエストパラメータとなるようにしてみました。 (asdf:load-system :cl-annot)(asdf:load-system :alexandria)(asdf:load-system :clack)(defpackage annotation  (:nicknames a)  (:export httpfn/clack))(defpackage http-as-function  (:use :cl)  (:nicknames httpfn)  (:export   :with-http-parameters   :*env*   :*request*))(in-package :http-as-function)(defparameter *request* nil)</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/416622683526228004/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2011/06/blog-post.html#comment-form' title='1 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/416622683526228004'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/416622683526228004'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2011/06/blog-post.html' title='リクエストパラメータを引数として扱う'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-1078640994403999607</id><published>2011-05-31T00:57:00.001+09:00</published><updated>2011-05-31T00:57:26.055+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><category scheme='http://www.blogger.com/atom/ns#' term='PythonImageLibrary'/><title type='text'>バイト列を画像に変換する</title><summary type='text'>目grepはできませんが、画像を作るくらいならできそうなのでやってみました。入力を1バイトずつ、値に応じた色のピクセルに変換して画像を作成します。値と表示色の関係はbin2colorをいじると変更できます。ひさびさにPythonを使ってみました。 #!/usr/bin/pythonimport sysimport os.pathimport Imageargvs = sys.argvargc = len(argvs)if (argc != 3) :    print 'Usage : %s [input-file] [output-file]' % argvs[0]    quit()in_file = argvs[1]out_file = argvs[2]filesize = os.path.getsize(in_file)x = 160y = filesize/x + 1print </summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/1078640994403999607/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2011/05/blog-post_31.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/1078640994403999607'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/1078640994403999607'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2011/05/blog-post_31.html' title='バイト列を画像に変換する'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-7396427232809277969</id><published>2011-05-28T00:20:00.001+09:00</published><updated>2011-05-28T00:20:03.234+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><title type='text'>リストの作成</title><summary type='text'>F#のyieldやyield!っぽいなにかを書いてみました。値を集めることしかしませんが、 loopマクロよりもリストを作りやすいのではないか、という気はします。 (defmacro yielding (&amp;body body)  (let ((gtail (gensym))	(ghead (gensym))	(garg (gensym))	(gtmp (gensym)))    `(let* ((,ghead (cons nil nil))	    (,gtail ,ghead))       (macrolet	   ((yield (,garg) `(setf (cdr ,',gtail) (cons ,,garg nil)				  ,',gtail (cdr ,',gtail)))	    (yield! (,garg) `(loop :for ,',gtmp :in ,,</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/7396427232809277969/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2011/05/blog-post.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/7396427232809277969'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/7396427232809277969'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2011/05/blog-post.html' title='リストの作成'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-5760788237741243329</id><published>2011-05-18T23:26:00.001+09:00</published><updated>2011-05-18T23:26:31.692+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='F#'/><title type='text'>F#入門</title><summary type='text'>F#はじめました。とりあえずFizzBuzz。 let fizzbuzz1 (tgt : int) =    [1..tgt]    |&gt; List.map        (fun n -&gt; if n % 15 = 0                  then printf "FizzBuzz\n"                  else if n % 5 = 0                  then printf "Buzz\n"                  else if n % 3 = 0                  then printf "Fizz\n"                  else printf "%d\n" n)    |&gt; ignorelet fizzbuzz2 (tgt : int) =    [1..tgt]    |&gt; </summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/5760788237741243329/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2011/05/f.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5760788237741243329'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5760788237741243329'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2011/05/f.html' title='F#入門'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-778640573770451705</id><published>2011-05-12T23:50:00.000+09:00</published><updated>2011-05-14T05:24:43.480+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><category scheme='http://www.blogger.com/atom/ns#' term='cl-annot'/><title type='text'>cl-annotを使ってインターフェースと実装を分離する</title><summary type='text'>cl-annotを使ってみるテストその2。機能を表す名前(関数名)と実際の実装を分離して、利用する際はアノテーションで実装を選択させてみます。試しにソケットを利用するための関数(インターフェース)を定義し、 2種類のライブラリを用いた実装(バックエンド)を作成して利用するようにしてみました。 (asdf:load-system :cl-annot)(use-package :cl-annot)(defun mk-impl-annot-name (sym)  (values   (intern (format nil "~A-IMPL" (symbol-name sym)))))(defun mk-use-annot-name (sym)  (values   (intern (format nil "USE-~A" (symbol-name sym)))))(defun </summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/778640573770451705/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2011/05/cl-annot_12.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/778640573770451705'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/778640573770451705'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2011/05/cl-annot_12.html' title='cl-annotを使ってインターフェースと実装を分離する'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-8492391525413891309</id><published>2011-05-12T21:50:00.000+09:00</published><updated>2011-05-14T05:24:43.235+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><category scheme='http://www.blogger.com/atom/ns#' term='cl-annot'/><title type='text'>cl-annotを使ってみる</title><summary type='text'>Common Lispでアノテーションを付け加えるライブラリ、cl-annotを使って遊んでみました。`注釈'でどこまでコードをいじっていいのかよく分からないので、便利なリーダマクロな扱いになってしまっているような。 (asdf:load-system :cl-annot)(use-package :cl-annot)(defpackage a  (:use)  (:export curry	   replace-symbol	   subst-symbol	   with-dot-slot-value-syntax));;;; シンボルの置き換えを行う(defun replace-symbol (fn sexp &amp;key (test (constantly t)))  (typecase sexp    (symbol (if (funcall test sexp) (funcall </summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/8492391525413891309/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2011/05/cl-annot.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/8492391525413891309'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/8492391525413891309'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2011/05/cl-annot.html' title='cl-annotを使ってみる'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-5322344818878442722</id><published>2011-05-05T23:21:00.002+09:00</published><updated>2011-05-05T23:21:55.966+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><title type='text'>矢印でメソッドチェイン風に記述する</title><summary type='text'>なんどか似たようなネタでコードを書いている気がします。矢印シンボルを用いて括弧の数を減らしてみます。矢印の`&gt;'の個数で式を挿入する位置を決定するようにしてみました。 (defun arrow-symbol? (sym) (when (symbolp sym)   (let ((name (symbol-name sym)))     (and (&lt;= 2 (length name))    (= (+ (count #\- name)   (count #\&gt; name))       (length name))    (string= (sort (copy-seq name) #'char&lt;)      name)))))(defun arrow-count (sym) (count #\&gt; (symbol-name sym)))(defun </summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/5322344818878442722/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2011/05/nil_05.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5322344818878442722'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5322344818878442722'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2011/05/nil_05.html' title='矢印でメソッドチェイン風に記述する'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-5652884665986317724</id><published>2011-05-05T22:32:00.002+09:00</published><updated>2011-05-05T22:41:04.859+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><title type='text'>deftypeとtypecaseを使ってfizzbuzz</title><summary type='text'>Common Lispのdeftypeを利用してみます。fizz,buzz,fizzbuzzをdeftypeで型として定義して、 typecaseを使って値を判別します。 (defun fizz? (n) (zerop (mod n 3)))(defun buzz? (n) (zerop (mod n 5)));;; 型定義;; fizz型は0以上の整数かつ関数fizz?に引数として渡すと真を返す値であると定義(deftype fizz () '(and (integer 0 *) (satisfies fizz?)))(deftype buzz () '(and (integer 0 *) (satisfies buzz?)))(deftype fizzbuzz () '(and   (integer 0 *)   (satisfies fizz?)   (satisfies buzz</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/5652884665986317724/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2011/05/nil.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5652884665986317724'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5652884665986317724'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2011/05/nil.html' title='deftypeとtypecaseを使ってfizzbuzz'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-7604211933602606545</id><published>2011-04-13T01:15:00.001+09:00</published><updated>2011-04-13T01:15:00.230+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><category scheme='http://www.blogger.com/atom/ns#' term='テスト'/><title type='text'>ユニットテストの記法を考える</title><summary type='text'>しばらくテストばかりしていたせいか、 Common Lispを触っているときもテストネタについて考えています。Common Lispには既にかなりの数のユニットテストツールがありますが、車輪の再開発上等というか、自分で考えるのも良いだろうということで、括弧の数を減らすような書き方を考えてみました。 (defpackage net.phorni.unittest  (:use :cl)  (:nicknames :ut)  (:export   test   run-test))(in-package :net.phorni.unittest)(defparameter *test-table* (make-hash-table));;;; condition(define-condition &lt;assertion-result&gt; (simple-condition)  ((form :</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/7604211933602606545/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2011/04/blog-post.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/7604211933602606545'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/7604211933602606545'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2011/04/blog-post.html' title='ユニットテストの記法を考える'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-6223736419775063476</id><published>2011-04-10T16:56:00.001+09:00</published><updated>2011-04-10T16:56:28.041+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><category scheme='http://www.blogger.com/atom/ns#' term='Emacs'/><title type='text'>hippie-expandでSLIMEの補完を利用する</title><summary type='text'>モードごとに補完関数を切り替えるelispを書いたので、 Common Lisp編集中にはelisp用のtry-complete-lisp-symbolではなく SLIMEの補完を行えるようなelispも書いてみました。補完候補を探す箇所以外はほとんどtry-complete-lisp-symbolと違いはありません。 (defun try-complete-slime-symbol (old)  (unless old    (he-init-string (he-lisp-symbol-beg) (point))    (unless (he-string-member he-search-string he-tried-table)      (setq he-tried-table (cons he-search-string he-tried-table)))    (setq</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/6223736419775063476/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2011/04/hippie-expandslime.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/6223736419775063476'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/6223736419775063476'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2011/04/hippie-expandslime.html' title='hippie-expandでSLIMEの補完を利用する'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-8035383795327395442</id><published>2011-04-01T22:31:00.001+09:00</published><updated>2011-04-01T22:31:08.219+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='EmacsLisp'/><title type='text'>hippie-expandの略語展開関数をmodeごとに指定する</title><summary type='text'>Emacsの補完機能の一つにhippie-expandというものがあります。hippie-expandは補完用関数のリストを設定すると、そのリストの先頭から順番に補完を試してくれます。私は主にlisp系言語で遊んでいるので、補完用関数のリストに lispのシンボル補完用関数を設定していたのですが、lispプログラミング以外を行っている時にもlispのシンボルが候補にあがってしまいます。Emacsのことなのですでに解決策はあるのでしょうが、とりあえず自作でmojor-mode/minor-modeごとに補完用関数を切り替えられるようなelispを書いてみました。 (require 'cl)(defvar mode-specified-try-functions-table (make-hash-table))(defun set-mode-specified-try-functions (</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/8035383795327395442/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2011/04/hippie-expandmode.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/8035383795327395442'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/8035383795327395442'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2011/04/hippie-expandmode.html' title='hippie-expandの略語展開関数をmodeごとに指定する'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-625126181754961171</id><published>2011-02-23T02:06:00.002+09:00</published><updated>2011-02-23T22:29:08.339+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='EmacsLisp'/><title type='text'>エターナル・フォース・コントロール</title><summary type='text'>Emacsのキーマップについて調べていたら、入力イベントを変換する機能というのを見つけたので無駄機能を使って遊んでみます。 (defun enable-force-ctrl ()(interactive)(aset keyboard-translate-table ?a ?\^a)(aset keyboard-translate-table ?b ?\^b)(aset keyboard-translate-table ?c ?\^c)(aset keyboard-translate-table ?d ?\^d)(aset keyboard-translate-table ?e ?\^e)(aset keyboard-translate-table ?f ?\^f)(aset keyboard-translate-table ?g ?\^g)(aset </summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/625126181754961171/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2011/02/blog-post.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/625126181754961171'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/625126181754961171'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2011/02/blog-post.html' title='エターナル・フォース・コントロール'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-3068915798602242383</id><published>2011-02-09T01:01:00.001+09:00</published><updated>2011-02-23T22:02:04.956+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><category scheme='http://www.blogger.com/atom/ns#' term='CommonQt'/><title type='text'>CommonQtでコンテキストメニュー</title><summary type='text'>CommonQtでコンテキストメニュー(右クリック時に出てくるメニュー)を出してみます。 (asdf:load-system :qt)(defpackage :test  (:use :cl :qt)  (:export main))(in-package :test)(enable-syntax)(defvar *qapp*)(defclass test-window ()  ((quit-action :accessor quit-action-of :initform nil)   (file-menu :accessor file-menu-of :initform nil))  (:metaclass qt-class)  (:qt-superclass "QMainWindow")  (:override   ("contextMenuEvent" </summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/3068915798602242383/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2011/02/commonqt.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/3068915798602242383'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/3068915798602242383'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2011/02/commonqt.html' title='CommonQtでコンテキストメニュー'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-5564855493219436432</id><published>2011-01-19T23:35:00.001+09:00</published><updated>2011-01-19T23:35:11.399+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><category scheme='http://www.blogger.com/atom/ns#' term='CommonQt'/><title type='text'>CommonQtでHello world!</title><summary type='text'>Common LispのQtバインディングであるCommonQtを触ってみました。 QtならマルチプラットフォームなのでどこでもGUIが使えます(たぶん)Qtのチュートリアルにある以下のようなC++のコードは // C++#include &lt;QApplication&gt;#include &lt;QPushButton&gt;int main(int argc, char *argv[]){	QApplication app(argc, argv);	QPushButton hello("Hello world!");	hello.resize(100, 30);	hello.show();	return app.exec();}このように書けるようです。 ;; Common Lisp (CommonQt)(asdf:load-system "qt")(defpackage :qt-user  (:</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/5564855493219436432/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2011/01/commonqthello-world.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5564855493219436432'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5564855493219436432'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2011/01/commonqthello-world.html' title='CommonQtでHello world!'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-1180897769876722100</id><published>2010-12-21T21:08:00.001+09:00</published><updated>2010-12-21T21:08:41.490+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='酒'/><category scheme='http://www.blogger.com/atom/ns#' term='本日の酒'/><title type='text'>本日の酒：鎌倉ビール 花</title><summary type='text'>本日の酒  鎌倉ビール 花(神奈川/鎌倉ビール醸造株式会社) </summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/1180897769876722100/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/12/blog-post_21.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/1180897769876722100'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/1180897769876722100'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/12/blog-post_21.html' title='本日の酒：鎌倉ビール 花'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-5945698037400076426</id><published>2010-12-19T18:57:00.001+09:00</published><updated>2010-12-19T18:57:07.530+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='酒'/><category scheme='http://www.blogger.com/atom/ns#' term='本日の酒'/><title type='text'>本日の酒:世界ビール紀行 ベルジャンエール</title><summary type='text'>本日の酒  世界ビール紀行 ベルギー ベルジャンエールタイプ(アサヒビール/福島工場) 琥珀ヱビス(サッポロビール) 今日も酒がおいしいです。</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/5945698037400076426/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/12/blog-post_19.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5945698037400076426'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5945698037400076426'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/12/blog-post_19.html' title='本日の酒:世界ビール紀行 ベルジャンエール'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-7826924555233473048</id><published>2010-12-15T23:37:00.001+09:00</published><updated>2010-12-15T23:37:28.106+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ELisp'/><title type='text'>昨日の続き(syntax-table)</title><summary type='text'>word-at-pointやsymbol-at-pointはメジャーモードごと、というかsyntax-tableごとに動きをかえてしまうので、適当なsyntax-tableを定義してつねにそいつを利用するようにしてみました。https://gist.github.com/740118</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/7826924555233473048/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/12/syntax-table.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/7826924555233473048'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/7826924555233473048'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/12/syntax-table.html' title='昨日の続き(syntax-table)'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-3227758908543667375</id><published>2010-12-15T00:19:00.001+09:00</published><updated>2010-12-15T00:19:20.226+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='EmacsLisp'/><title type='text'>Emacsで単語の省略形を定義する</title><summary type='text'>最近どうにかして同じようなコードを何度も何度も何度も書くような真似をしなくて良い方法はないだろうかと考えています。基本的にEmacsユーザーなので、Elispでそれっぽい機能を書けばいいんじゃないかと考えて思いついたネタの一つが、劣化yasnippetといいますか、単にある文章(単語)の省略形を登録しておいて、それを展開してもとの文章(単語)になるようにする、というものでした。まぁ、補完があるのでたいして役に立たないかもしれません。 (require 'cl);;; メジャーモードで分けたほうがよいだろうか(defvar shorthand:*shorthand-expand-ht*  (make-hash-table :test 'equal))(defvar shorthand:*shorthand-fold-ht*  (make-hash-table :test 'equal))(</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/3227758908543667375/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/12/emacs%E3%81%A7%E5%8D%98%E8%AA%9E%E3%81%AE%E7%9C%81%E7%95%A5%E5%BD%A2%E3%82%92%E5%AE%9A%E7%BE%A9%E3%81%99%E3%82%8B.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/3227758908543667375'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/3227758908543667375'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/12/emacs%E3%81%A7%E5%8D%98%E8%AA%9E%E3%81%AE%E7%9C%81%E7%95%A5%E5%BD%A2%E3%82%92%E5%AE%9A%E7%BE%A9%E3%81%99%E3%82%8B.html' title='Emacsで単語の省略形を定義する'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-656413382532016646</id><published>2010-12-08T21:19:00.001+09:00</published><updated>2010-12-08T21:19:01.656+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='酒'/><category scheme='http://www.blogger.com/atom/ns#' term='日本酒'/><title type='text'>最近飲んでいる(いた)日本酒リスト</title><summary type='text'> 賀儀屋 無濾過純米吟醸 (愛媛/成龍酒造株式会社) 古緑川(平成9年度産) (新潟/緑川酒造株式会社) 櫻室町 吟醸純米酒 (岡山/室町酒造株式会社) 幻の瀧 山田錦大吟醸袋しぼり(製造No.0428) (富山/皇国晴酒造株式会社) 伝兵衛 純米 (石川/合名会社中島酒造店) 霧筑波 特別純米酒 (茨城/合名会社浦里酒造店) 「皇国晴」は「みくにはれ」と読むらしい。</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/656413382532016646/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/12/blog-post.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/656413382532016646'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/656413382532016646'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/12/blog-post.html' title='最近飲んでいる(いた)日本酒リスト'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-2282617298567168453</id><published>2010-12-06T23:55:00.001+09:00</published><updated>2010-12-06T23:55:44.454+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><category scheme='http://www.blogger.com/atom/ns#' term='cl-gtk2'/><category scheme='http://www.blogger.com/atom/ns#' term='GUI'/><title type='text'>cl-gtk2</title><summary type='text'>cl-gtk2を使ってウィンドウに絵を書いてみます。 ;;(asdf:load-system :cl-gtk2-glib);;(asdf:load-system :cl-gtk2-gdk);;(asdf:load-system :cl-gtk2-cairo)(defun run-test-1 ()  (let ((out *standard-output*))    (gtk:within-main-loop      (let ((window (make-instance 'gtk:gtk-window				   :type :toplevel				   :window-position :center				   :title "run-test-1"				   :default-width 300				   :default-height 100))	    (area </summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/2282617298567168453/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/12/cl-gtk2.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/2282617298567168453'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/2282617298567168453'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/12/cl-gtk2.html' title='cl-gtk2'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-2611060349650685240</id><published>2010-11-28T00:30:00.001+09:00</published><updated>2010-11-28T00:30:07.383+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><category scheme='http://www.blogger.com/atom/ns#' term='ネタ'/><title type='text'>たくさんの閉じ括弧を不快に思う人のためのリーダマクロ</title><summary type='text'>本日(2010/11/27)はShibuya.lisp TT6に参加してきました。Lisperばかりが70以上も集まるという、とても楽しいイベントでした。運営、発表者、会場、その他参加者の皆様、どうもありがとうございました。内容についてはきっとどなたかがナイスな感じでまとめてくださるはずなので、帰宅して書いてみたネタを晒そうと思います。今日のTTで Programming 2.0 という話題がでました。自分の中で要約すると、「おいコンパイラ、そのくらいのタイポでエラーをだすな。俺がやりたいことくらいわかるだろ？」という感じになりましたが、そのあたりに関連して、「Lispのネストした閉じ括弧をたくさん書くのが面倒、わかりにくい」というようなつぶやきが聞こえてきたので、なんとかしてみようと頑張ってみました。 (defparameter *unclose-parenthesis* 0)(</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/2611060349650685240/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/11/blog-post_28.html#comment-form' title='1 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/2611060349650685240'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/2611060349650685240'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/11/blog-post_28.html' title='たくさんの閉じ括弧を不快に思う人のためのリーダマクロ'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-8342115361457285472</id><published>2010-11-26T21:28:00.001+09:00</published><updated>2010-11-26T21:28:37.233+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><title type='text'>LOLを参考に間接参照</title><summary type='text'>Let Over Lambda(LOL)のalambda,aletあたりを読んで間接参照を定義する単純な方法を考えてみました。 (let ((set-sym (gensym))      (deref-sym (gensym)))  (defun ref (fn)    (let ((this fn))      (lambda (&amp;rest args)	(cond	  ((eq (car args) set-sym)	   (setf this (cadr args)))	  ((eq (car args) deref-sym)	   this)	  (T (apply this args))))))  (defun deref (ref)    (funcall ref deref-sym))  (defun (setf deref) (fn ref)    (funcall ref</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/8342115361457285472/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/11/lol.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/8342115361457285472'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/8342115361457285472'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/11/lol.html' title='LOLを参考に間接参照'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-1742578770243423774</id><published>2010-11-25T00:13:00.001+09:00</published><updated>2010-11-25T00:13:55.331+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><title type='text'>#`..`で外部コマンドの出力を取得する</title><summary type='text'>Perlのバッククオートをパクってみました。とりあえず、kmrclのcommand-outputを使いめんどくさいところを丸投げします。 (asdf:oos 'asdf:load-op :kmrcl)(defun |#`-reader| (stream ch numarg)  (declare (ignore ch numarg))  (let (acc-fmt acc-args)    (loop       :for curr = (read-char stream)       :until (char= curr #\`)       :do       (if (char= curr #\\)	   (let ((c (read-char stream)))	     (case c	       ((#\n) (push #\Newline acc-fmt))	       </summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/1742578770243423774/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/11/blog-post_25.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/1742578770243423774'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/1742578770243423774'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/11/blog-post_25.html' title='#`..`で外部コマンドの出力を取得する'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-4613935299196235023</id><published>2010-11-20T06:26:00.001+09:00</published><updated>2010-11-20T06:26:13.180+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><title type='text'>ASDF-INSTALLでhttpsからのインストールを行う</title><summary type='text'>asdf-installはURLを指定するとそこからパッケージをダウンロードしてインストールしてくれますが、httpsには対応していません(たぶん)GitHubがいつの間にかhttpsのみのサポートに切り替わっていたので、 URLを指定してプロジェクトをインストールすることができなくなりました。とりあえず、CL+SSLを利用してhttpsでも動かせるようなコードを書いてみました。パッケージ名が文字列かつ"https://"から始まっている場合の動きを若干追加しています。 (asdf:oos 'asdf:load-op :cl+ssl)(in-package :asdf-install)(setf (symbol-function 'make-stream-from-url-old)      #'make-stream-from-url)(setf (symbol-function '</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/4613935299196235023/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/11/asdf-installhttps.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/4613935299196235023'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/4613935299196235023'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/11/asdf-installhttps.html' title='ASDF-INSTALLでhttpsからのインストールを行う'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-8709440942708642511</id><published>2010-11-18T22:06:00.001+09:00</published><updated>2010-11-18T22:06:44.824+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><title type='text'>テストツールその2</title><summary type='text'>関数を簡単にテストするなら、このくらい単純で良いような気もしました。 (defvar *test-function-table* (make-hash-table));; clause -&gt; ((arg1 arg2 ... ) result) = ((arg1 arg2 ... ) :eq result);; clause -&gt; ((arg1 arg2 ... ) :not result);; clause -&gt; ((arg1 arg2 ... ) :test test-fn)(defparameter *test-report-function*  #'(lambda (fn-name args expected actual)      (format t "TEST FAILED. Form: (~A ~{~A~^ ~}), Expected: ~A, Actual: ~A~%"</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/8709440942708642511/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/11/2.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/8709440942708642511'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/8709440942708642511'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/11/2.html' title='テストツールその2'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-4769468433659265708</id><published>2010-11-18T21:47:00.001+09:00</published><updated>2010-11-18T21:47:17.630+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><category scheme='http://www.blogger.com/atom/ns#' term='GUI'/><category scheme='http://www.blogger.com/atom/ns#' term='ネタ'/><title type='text'>Common Lispで図形を描くための27の方法</title><summary type='text'>ありがちなタイトルの付け方ですね。Common Lispで図形を描くために取り得る手段を列挙してみました。一部現在は使えないか、使うために努力が必要なものがあるかもしれません。  CUIで充分だよ派  表示されれば良いよ派 format関数 Cursesを使うよ派 cl-Ncurses  ファイルに書き出すよ派  Lispで何とかするよ派  PNG派 zpng JPEG派 cl-jpeg PDF派 cl-pdf なんでも来いよ派 ch-image, IMAGO ベクタイメージで書いてPNGにするよ派 vecto  外部ライブラリを使うよ派  ImageMagic派  cl-magic libpng派 CL-PNG グラフを書くよ派(Graphviz) cl-dot, s-dot, cl-graphviz GDを使うよ派 cl-gd   ウィンドウに表示するよ派  Lispでなんとかするよ</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/4769468433659265708/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/11/common-lisp27.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/4769468433659265708'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/4769468433659265708'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/11/common-lisp27.html' title='Common Lispで図形を描くための27の方法'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-8417680038356922399</id><published>2010-11-08T20:50:00.001+09:00</published><updated>2011-02-23T22:03:19.398+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Test'/><title type='text'>ユニットテストツールのようななにか</title><summary type='text'>動的言語を使う人達は、簡単なユニットテストくらいなら言語自体の機能をつかってぱぱっと書いてしまうのではないかと想像しています。私は趣味で適当なプログラムを書いているだけでろくにテストをしませんが、カバレッジのとりかたもわかったことなのでテストツールを書いてみました。前のエントリでは、SBCLでのカバレッジの結果の出力先はファイルパスと書きましたが、どうもSBCLでもディレクトリのパスっぽいです。どうしてファイルを指定すると思い込んでいたのでしょう。 (defpackage unit-test  (:use :cl)  (:shadow cl:assert)  (:nicknames :utest)  (:export test-error	   assert	   do-as-test	   define-test-case	   *unit-test-error-port*	   *</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/8417680038356922399/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/11/blog-post_08.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/8417680038356922399'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/8417680038356922399'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/11/blog-post_08.html' title='ユニットテストツールのようななにか'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-4779938847663443093</id><published>2010-11-08T20:12:00.001+09:00</published><updated>2010-11-08T20:12:53.835+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><title type='text'>メソッドがクラスに属しているかのような錯覚をおこす為のマクロ</title><summary type='text'>タイトルどおりのものを作ろうとしてみましたが案の定ぐだぐだに。Common Lispのインスタンス変数(スロット)は :allocation :class と指定することで同じクラスのオブジェクトで共有されますが、共有されるだけで実際にインスタンスを生成しなければアクセスすることができません(たぶん)。なので、クラス変数をメタクラスのインスタンス変数とすることで他のオブジェクト指向言語に近付こうとしてみました。ソースコードはgistに置きました。https://gist.github.com/662369 ;; example(class &lt;foo&gt; ()  (def sum ()    (+ @@a @b))  (setf @@a 10)  (def set-b (b)    (setf @b b)))(defvar *obj* (make-instance '&lt;foo&gt; :b 20)</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/4779938847663443093/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/11/blog-post.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/4779938847663443093'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/4779938847663443093'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/11/blog-post.html' title='メソッドがクラスに属しているかのような錯覚をおこす為のマクロ'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-3547886327345121025</id><published>2010-11-03T14:35:00.001+09:00</published><updated>2010-11-03T14:35:43.404+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><category scheme='http://www.blogger.com/atom/ns#' term='Test'/><title type='text'>SBCLとCCLでのカバレッジの取りかた</title><summary type='text'>SBCLとClozure Common Lisp(以下CCL)にはファイルのカバレッジを取り、HTMLで出力してくれる機能があるようです。CCLでは ccl:*compile-code-coverage*をTにしてからカバレッジを取りたいファイルをコンパイル-&gt;ロードして、テストの実行とカバレッジの集計結果出力を行います。SBCLでは、SB-COVERパッケージを読み込んでから、ファイルのコンパイル、ロード、テスト実行、結果の出力を行います。結果の出力時に指定するパスは、CCLではファイル名ですが、SBCLではディレクトリ名のようです。 (defun compile-and-load (path)  (compile-file path)  (load path));;; clozure common lisp(setf ccl:*compile-code-coverage* t)(</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/3547886327345121025/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/11/sbclccl.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/3547886327345121025'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/3547886327345121025'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/11/sbclccl.html' title='SBCLとCCLでのカバレッジの取りかた'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-1767609754438289730</id><published>2010-11-03T14:22:00.001+09:00</published><updated>2010-11-03T14:22:05.206+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term=': CommonLisp'/><title type='text'>lengthとeltのgeneric-function版</title><summary type='text'>Common Lispパッケージの内容を上書きするのはよろしく無いのではと思い、適当な名前でタイトル通りのものを書いてみました。 (defun defmethods-args-expander (args specifiers)  (when (&lt; (length args) (length specifiers))    (error "Too many specifiers"))  (labels      ((inner (ar sr acc)(if (null ar)(nreverse acc)(inner (cdr ar)(cdr sr)(cons(if (null sr)(car ar)(list (car ar) (car sr)))acc)))))    (inner args specifiers nil)))(defun </summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/1767609754438289730/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/11/lengtheltgeneric-function.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/1767609754438289730'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/1767609754438289730'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/11/lengtheltgeneric-function.html' title='lengthとeltのgeneric-function版'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-6542111344978576621</id><published>2010-10-25T22:28:00.001+09:00</published><updated>2010-10-25T22:28:07.065+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='McCLIM'/><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><title type='text'>McCLIMで接続するディスプレイを選択する</title><summary type='text'>McCLIMはX11プロトコルをしゃべるためにCLXを利用しています。なのでディスプレイ番号などを指定するのは最終的にはCLXの役割です。McCLIMからCLXのopen-displayがどのように呼ばれるかを眺めることで、接続するディスプレイを選択する方法がわかったような気分になりました。 (asdf:oos 'asdf:load-op :mcclim)(sb-posix:getenv "DISPLAY");;=&gt; ":0.0";; .Xauthorityを読み込み、 ホスト名、ディスプレイ番号、プロトコルに対応する;; :authorization-nameと:authorization-dataを取得する(xlib::get-best-authorization "localhost" 0 :local);; =&gt;"MIT-MAGIC-COOKIE-1";; =&gt;#(161 76 </summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/6542111344978576621/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/10/mcclim.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/6542111344978576621'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/6542111344978576621'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/10/mcclim.html' title='McCLIMで接続するディスプレイを選択する'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-3947672824965654857</id><published>2010-10-23T00:44:00.001+09:00</published><updated>2010-10-23T00:44:08.631+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><category scheme='http://www.blogger.com/atom/ns#' term='CLOS'/><title type='text'>CLOSでオブジェクトのクラスを変更する</title><summary type='text'>Common LispのオブジェクトシステムであるCLOSには、実行時にオブジェクトのクラスを変更する機能や、クラスを再定義するとそのクラスのオブジェクトが新しいクラスのオブジェクトへ変更されるという機能があるそうです。それぞれの動作を制御するためのメソッドが update-instance-for-different-class と update-instance-for-redefined-class です。ともに関数名が35文字で、Common Lispの仕様上最長の関数名です。ちなみに、変数名を含めれば least-positive-normalized-double-float などの38文字が最長であるようです。 ;;;; update-instance-for-different-class(defclass class-a ()  ((a :accessor a-of :</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/3947672824965654857/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/10/clos.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/3947672824965654857'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/3947672824965654857'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/10/clos.html' title='CLOSでオブジェクトのクラスを変更する'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-7911722960089813986</id><published>2010-10-15T23:58:00.001+09:00</published><updated>2010-10-15T23:58:47.547+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><title type='text'>動的束縛なlabels</title><summary type='text'>fletやlabelsはlexical bindingなので、定義した関数の名前は字面上現れる位置でないと利用できません。 &gt;(defun hoge ()   (print 3))&gt;(defun fuga ()   (hoge))&gt;(fuga)3&gt;(labels   ((hoge ()     (print 10)))  (fuga))3変数ならばdeclareでspecial変数だと宣言すれば良いけれど、関数の場合どうすれば良いか分からなかったのでマクロを書いてみました。 (defun generic-function-p (x)  #+SBCL (sb-pcl::generic-function-p x)  #-SBCL nil)(defmacro dynamic-labels    ((&amp;rest definitions) &amp;body body)  (let ((olds (</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/7911722960089813986/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/10/labels.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/7911722960089813986'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/7911722960089813986'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/10/labels.html' title='動的束縛なlabels'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-1985726478626193778</id><published>2010-10-15T20:36:00.001+09:00</published><updated>2010-10-15T20:36:49.080+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='LISP'/><title type='text'>(Lisp (を書いて学ぶ) Ruby)</title><summary type='text'>Peter Norvigせんせーの記事の邦訳、((Pythonで) 書く (Lisp) インタプリタ) を写経してみました。Rubyで。 class String  def tokenize()    return self.gsub(/(\(|\))/){|s| " " + s + " " }.split(' ');  endenddef parse(tokens)  if(tokens.length == 0)    raise "error"  end  tk = tokens.shift  if(tk == "(")    acc = []    while ( (tk = tokens.shift) != ")")      if(tk == "(")        acc.unshift(parse(tokens.unshift(tk)))      else        </summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/1985726478626193778/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/10/lisp-ruby.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/1985726478626193778'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/1985726478626193778'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/10/lisp-ruby.html' title='(Lisp (を書いて学ぶ) Ruby)'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-5759211673051575976</id><published>2010-10-04T22:20:00.001+09:00</published><updated>2010-10-04T22:20:07.024+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><title type='text'>Common Lispでexpect的ななにか</title><summary type='text'>最近存在を知りましたが、鯖やってる人にはお馴染み?らしいexpectというプログラムが存在するそうです。TCLで書かれたプログラムで、Passwordという文字列が表示されたらxxxを入力する、というような形で、対話的なコマンドを自動実行するために利用するものとのことです。PerlやPython、Rubyなどにもそれっぽいライブラリが存在し、なんとGuileにまでexpect.scmというファイルにモジュールが存在します。Common Lispにもあるよね・・・と思っていたら見つからないので、Guileのプログラムを一部パクって簡単なものを書いてみました。 (asdf:oos 'asdf:load-op :cl-ppcre)(defpackage expect  (:use :cl :cl-ppcre)  (:export expect expect-strings))(</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/5759211673051575976/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/10/common-lispexpect.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5759211673051575976'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5759211673051575976'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/10/common-lispexpect.html' title='Common Lispでexpect的ななにか'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-1286767599677786619</id><published>2010-09-24T22:59:00.001+09:00</published><updated>2010-09-24T22:59:43.913+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><title type='text'>Common Lispで (object method args...)の形式でメソッド呼び出し</title><summary type='text'>Common Lispのオブジェクトシステムはそのまんまのネーミングで、 Common Lisp Object System (CLOS:シーロス、クロス)と言います。CLOSでは、メソッド呼び出しが普通の関数呼び出しと同じように (method object args...) という形式になっていますが、これは他のオブジェクト指向言語から見たらへんてこな順序で、わかりにくいかもしれません。 Javaを触ってきた人からすると、(object method args...)と書きたいでしょう。たぶん。当然、用意されている書き方が気にくわないならば自分で書き換えてしまうのがCommon Lisp なので、解決方法はいくつかあるかと思います。仕様にはなっていませんが、CLOSに加えて Meta Object Protocol(MOP)という、デファクトスタンダード的なメタプログラミングの方法が</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/1286767599677786619/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/09/common-lisp-object-method-args.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/1286767599677786619'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/1286767599677786619'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/09/common-lisp-object-method-args.html' title='Common Lispで (object method args...)の形式でメソッド呼び出し'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-5816219157997407885</id><published>2010-09-23T21:06:00.001+09:00</published><updated>2010-09-23T21:06:14.468+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PostScript'/><category scheme='http://www.blogger.com/atom/ns#' term='Emacs'/><title type='text'>EmacsからGhostScriptを利用する</title><summary type='text'>make-comintを使ってみたかったので。 (defun postscript-process ()  (get-buffer-process (get-buffer "*postscript*")))(defun run-postscript ()  (interactive)  (require 'comint)  (switch-to-buffer (make-comint "postscript" "gs")))(push '("postscript" . utf-8) process-coding-system-alist)(defun to-postfix (s)  (if (atom s) `(,s)      `(,@(cdr s)	  ,(car s))))(defun send-postscript-no-newline (s &amp;optional ps)  (</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/5816219157997407885/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/09/emacsghostscript.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5816219157997407885'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5816219157997407885'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/09/emacsghostscript.html' title='EmacsからGhostScriptを利用する'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-3972933531237575892</id><published>2010-09-17T21:53:00.001+09:00</published><updated>2010-09-17T21:53:19.443+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ELisp'/><title type='text'>ELispでobjdumpを呼んでバイト列を逆アセンブルする</title><summary type='text'>Linuxなどでプログラムを逆アセンブルする際には、objdumpを使うと便利です、たぶん。Twitterなどでバイナリアンな方々が16進数で会話をしているのについていけなくて困るときのために、 Emacsからobjdumpを呼んでバイト列を逆アセンブルするようなELispを書いてみました。バイト列といってもリストしか対応していませんが。 (defvar *arch-type* "i386")(defun make-disasm-command (target file)  (format "objdump -b binary -m %s -D %s" target file))(defun make-perl-command (lst tmp-file)  (concat   "perl -e 'print \""   (apply    'concat    (mapcar     </summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/3972933531237575892/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/09/elispobjdump.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/3972933531237575892'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/3972933531237575892'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/09/elispobjdump.html' title='ELispでobjdumpを呼んでバイト列を逆アセンブルする'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-6731567572508854581</id><published>2010-09-17T00:08:00.001+09:00</published><updated>2010-09-17T00:08:47.671+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><title type='text'>超リードマクロに対抗してchar-codeの限界までリードマクロ</title><summary type='text'>CLerはもっと他人のネタに反応すべきらしいので対抗してみた。元ネタは @nitro_idiot さん の:　SBCLのリーダを上書きして"超リードマクロ"を実装組み込みのリーダを書き換えるのは敷居が高いので、ごく普通の方法にしました。正規表現ライブラリのcl-ppcreを利用していますが、それ以外はごく標準的なCommon Lispです。私はSBCLで動かしましたが、CL処理系なら大抵は動くのではないでしょうか。 (asdf:oos 'asdf:load-op :cl-ppcre)(defun range-symbol-name-p (str)  (and (= (length (cl-ppcre:all-matches "\\.\\." str)) 2)       (= (length (cl-ppcre:split "\\.\\." str)) 2)))(defun </summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/6731567572508854581/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/09/char-code.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/6731567572508854581'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/6731567572508854581'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/09/char-code.html' title='超リードマクロに対抗してchar-codeの限界までリードマクロ'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-1144621940997687553</id><published>2010-09-13T23:12:00.001+09:00</published><updated>2010-09-13T23:12:35.174+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><title type='text'>list処理マクロ</title><summary type='text'>map系関数のような処理をするマクロを作ってみました。いつもどおり毒にも薬にもならない感じです。 (defvar *mapping-action-keywords*  `(:collect :collect-if     :remove :remove-if     :reverse :append     :funcall     :action))(defvar *mapping-action-optional-keywords*  `(:if :key))(defvar *mapping-action-optional-sub-keywords*  `(:else))(defun action-keyword-p (sym)  (member sym *mapping-action-keywords*))(defun action-optional-keyword-p (sym)</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/1144621940997687553/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/09/list.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/1144621940997687553'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/1144621940997687553'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/09/list.html' title='list処理マクロ'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-5084508599699553039</id><published>2010-09-08T23:25:00.001+09:00</published><updated>2010-09-08T23:25:13.876+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><title type='text'>古い値を利用する更新処理(Common Lisp)</title><summary type='text'>Clojureのswap!はアトムの古い値を引数にして関数を呼び出し、その結果を新しい値とします。たしか。似たような値の更新方法をCommon Lispで計4パターン書いてみました。 (defmacro update/fn-1! (generaized-variable update-fn &amp;rest args)  (let ((old-val (gensym)))    `(let ((,old-val ,generaized-variable))       (setf ,generaized-variable (funcall ,update-fn ,old-val ,@args))       ,old-val)))(defmacro update/fn-2! (generaized-variable update-fn &amp;rest args)  `(setf ,</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/5084508599699553039/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/09/common-lisp.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5084508599699553039'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5084508599699553039'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/09/common-lisp.html' title='古い値を利用する更新処理(Common Lisp)'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-4885568766813533200</id><published>2010-09-08T22:10:00.001+09:00</published><updated>2010-09-08T22:10:09.712+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><title type='text'>Common Lisp でC風switch その2</title><summary type='text'>C風switchをgoを使わない形に書き直して見ました。caseの実行する式の部分に、後続で処理するすべての式をぶち込んでいます。今回は明示的にブロックを抜けない限り、最後に評価された値が返ります。 (defmacro switch-2 (val &amp;body clauses)  (let ((break (gensym)))    `(block ,break       (macrolet ((break-switch ()		    `(return-from ,',break nil)))	 (case ,val	   ,@(maplist	      #'(lambda (rest)		  `(,(caar rest) ,@(loop :for i in rest				      :append (cdr i))))	      clauses))))));; example(</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/4885568766813533200/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/09/common-lisp-cswitch-2.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/4885568766813533200'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/4885568766813533200'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/09/common-lisp-cswitch-2.html' title='Common Lisp でC風switch その2'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-4403213936479699609</id><published>2010-09-08T00:06:00.001+09:00</published><updated>2010-09-08T00:06:08.503+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><title type='text'>Common Lisp で C 風のswitch</title><summary type='text'>Twitterを眺めていたらネタに出会ったので書いてみました。 (defmacro switch (val &amp;body clauses)  (let ((syms (loop :repeat (length clauses)		 :collect (gensym))))    `(tagbody	(case ,val	  ,@(mapcar	     #'(lambda (clause sym)		 `(,(car clause) (go ,sym)))	     clauses	     syms))	,@(mapcan	   #'(lambda (clause sym)	       `(,sym ,@(cdr clause)))	   clauses	   syms)      break)))switchのclauses部にはCommon Lispのcaseと同様の式を書</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/4403213936479699609/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/09/common-lisp-c-switch.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/4403213936479699609'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/4403213936479699609'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/09/common-lisp-c-switch.html' title='Common Lisp で C 風のswitch'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-2296190654092665569</id><published>2010-09-07T23:00:00.001+09:00</published><updated>2010-09-07T23:00:13.408+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><title type='text'>Common Lispでforマクロ その2</title><summary type='text'>昨日の続きのforマクロ。昨日のままだと、外側のletのbinding内でそんなシンボル無いです、と怒られて動かないことがあると思われるので修正．せっかくなのでgithubを活用する事にしました。http://github.com/kurohuku/for-loop現状の動作はこんな感じです。 (for ((a :in (list 1 2))      (b :range 4 6)      (c :across #(10 11)))  (list a b c));; =&gt; ((1 4 10) (1 4 11) (1 5 10) (1 5 11);;     (2 4 10) (2 4 11) (2 5 10) (2 5 11))</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/2296190654092665569/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/09/common-lispfor-2.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/2296190654092665569'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/2296190654092665569'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/09/common-lispfor-2.html' title='Common Lispでforマクロ その2'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-6304138793273727367</id><published>2010-09-06T23:57:00.001+09:00</published><updated>2010-09-06T23:57:47.915+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><title type='text'>Common Lispでオレオレforマクロを定義する</title><summary type='text'>Common Lispにはやたらと高機能なかわりに構文がおかしなloopマクロが存在します。loopマクロは高機能なのですが、多重ループを処理しようとすると collect や nconc などのキーワードを使ってネストさせる必要があります(多分)。Clojureのforは多重ループ(のようなもの)を簡潔に記述できるので、似たような構文をマクロで定義してみようと思います。 (defun enumrate (from to)  (loop :for i from from to to :collect i))(defun pattern-binding (form pattern)  (if (/= (length form) (length pattern))      nil      (let ((binding	     (mapcar	      #'(lambda (f p)</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/6304138793273727367/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/09/common-lispfor.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/6304138793273727367'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/6304138793273727367'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/09/common-lispfor.html' title='Common Lispでオレオレforマクロを定義する'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-5615114410525598234</id><published>2010-09-01T23:29:00.001+09:00</published><updated>2010-09-01T23:29:35.864+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><title type='text'>Common Lisp でC++風出力</title><summary type='text'>githubを試しに使ってみるテスト。C++のストリーム出力っぽい雰囲気になるように gray streamsを使ってみました。http://github.com/kurohuku/manip-stream動作させるには trivial-gray-streams が必要です。 &gt;(&lt;&lt; (make-instance 'manip-output-stream		   :stream *standard-output*)    +binary+    (set-width 8)    (set-fill #\0)    +left+    3)00000011#&lt;MANIP-OUTPUT-STREAM {DDF79C9}&gt;stream-write-stringの引数がstream-manipulatorクラスのオブジェクトの場合、manip-streamを引数としてactionスロットの関数</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/5615114410525598234/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/09/common-lisp-c.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5615114410525598234'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5615114410525598234'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/09/common-lisp-c.html' title='Common Lisp でC++風出力'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-4748607317332002370</id><published>2010-08-28T22:58:00.001+09:00</published><updated>2010-08-28T22:58:05.771+09:00</updated><title type='text'>ClojureでJWindowを作る</title><summary type='text'>ふせんちっくなウィンドウを作ってみます。無駄にクリック時の動作をかえられるようにしたりしてみました。 ;;; MouseAdapter(ns example.MouseAdapter (:gen-class  :extends java.awt.event.MouseAdapter  :init init  :state actionTable  :constructors {[clojure.lang.Atom][] [][]}  :main false;;  :expose-methods {mouseClicked mouseClicked}  :methods  [   [clickAction [java.awt.event.MouseEvent] void]   [doubleClickAction [java.awt.event.MouseEvent] void]   [</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/4748607317332002370/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/08/clojurejwindow.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/4748607317332002370'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/4748607317332002370'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/08/clojurejwindow.html' title='ClojureでJWindowを作る'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-5884439123108619594</id><published>2010-08-28T19:41:00.001+09:00</published><updated>2010-08-28T19:41:06.640+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><title type='text'>Clojureのメソッドチェイン風マクロをCommon Lispのマクロで書いてみる</title><summary type='text'>すでにいろいろなところで書かれているネタな気はしますが、書いてみました。-&gt;はexpを次の式の第一引数の位置に挿入し、 -&gt;&gt;はexpを次の式の最後の引数の位置に挿入します。 (defmacro -&gt; (exp &amp;rest rest)  (if rest      (let ((fst (car rest))	    (rest (cdr rest)))	(typecase fst	  (symbol  `(-&gt; (,fst ,exp) ,@rest))	  (atom  `(-&gt; (,fst ,exp) ,@rest))	  (list `(-&gt; (,(car fst) ,exp ,@(cdr fst)) ,@rest))))      exp))(defmacro -&gt;&gt; (exp &amp;rest rest)  (if rest      (let ((fst (car rest))</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/5884439123108619594/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/08/clojurecommon-lisp.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5884439123108619594'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5884439123108619594'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/08/clojurecommon-lisp.html' title='Clojureのメソッドチェイン風マクロをCommon Lispのマクロで書いてみる'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-2023143143842499010</id><published>2010-08-28T18:05:00.001+09:00</published><updated>2010-08-28T18:05:57.597+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Clojure'/><title type='text'>Clojureでバイナリファイルを読み込む</title><summary type='text'>実践Common Lisp(Practical Common Lisp)のバイナリファイルのパースっぽいものを書こうとしてみました。 (defmulti read-binary-class (fn [class in] class))(defmulti read-binary-raw (fn [class in] class))(def *class-list* (atom []))(def *direct-super-classes-map* (atom {}))(defn defined-class-p [sym]  (some #(= sym %1) @*class-list*));; Symbol like &lt;xxx&gt; means forward declaration(defn forward-declaration-symbol-p [sym]  (let [tmp (str</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/2023143143842499010/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/08/clojure.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/2023143143842499010'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/2023143143842499010'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/08/clojure.html' title='Clojureでバイナリファイルを読み込む'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-4937582350578037310</id><published>2010-08-26T23:41:00.001+09:00</published><updated>2010-08-26T23:41:10.298+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><title type='text'>符号的プログラミングのすすめ on Common Lisp</title><summary type='text'>初めに Lispの括弧ネタ(注1)に触発されて思い浮かんだネタを書いていきます。注1: @nitro_idiotさん http://e-arrows.sakura.ne.jp/2010/08/is-lisp-really-has-too-many-parenthesis.html 符号的プログラミングについて Perlは非常にリッチな言語です。世界はPerlでかかれているらしいです。Perl最強ですね。このPerl言語のエキスパートたちが、Perlの持つリッチな機能をフル活用するプログラミングスタイルを符号的プログラミングと呼びます。Perlには及ばないかもしれませんが、私の大好きなCommon Lispも非常にリッチな言語なため、符号的プログラミングを行うことができます。これから、一般的なスタイルのCommon Lispプログラムをいかにして符号的なスタイルに変換していくかを見</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/4937582350578037310/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/08/on-common-lisp.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/4937582350578037310'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/4937582350578037310'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/08/on-common-lisp.html' title='符号的プログラミングのすすめ on Common Lisp'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-1798423528519558433</id><published>2010-08-26T22:33:00.000+09:00</published><updated>2010-08-26T22:34:00.072+09:00</updated><title type='text'>文体</title><summary type='text'>文体をですます風味に変更してみます．こっちのほうが適当っぽさがでるので．</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/1798423528519558433/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/08/blog-post.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/1798423528519558433'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/1798423528519558433'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/08/blog-post.html' title='文体'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-8072388617095974129</id><published>2010-08-19T22:24:00.001+09:00</published><updated>2010-08-19T22:24:51.365+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ELisp'/><category scheme='http://www.blogger.com/atom/ns#' term='Emacs'/><title type='text'>Emacsで指定した正規表現が現れる場所までkillする</title><summary type='text'>C-hやC-dを連打するのに疲れたので、タイトルどおりのEmacs Lisp関数を作ってみた。 M-dなどをうまく駆使すれば連打の必要はなかったのかもしれないけれど。実は組み込みで求めている機能がある、なんてことはないと信じたい。 (defun kill-to-regexp-forward (regexp)  (interactive "sRegexp:")  (let ((start-point (point)))    (when (re-search-forward regexp nil t)      (re-search-backward regexp nil t)      (kill-region start-point (point)))))(defun kill-to-regexp-backward (regexp)  (interactive "sRegexp:")</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/8072388617095974129/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/08/emacskill.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/8072388617095974129'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/8072388617095974129'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/08/emacskill.html' title='Emacsで指定した正規表現が現れる場所までkillする'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-5294390741185662373</id><published>2010-08-17T22:58:00.001+09:00</published><updated>2010-08-17T22:58:38.114+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='旅行'/><category scheme='http://www.blogger.com/atom/ns#' term='神社'/><title type='text'>旅行履歴(2010/08/11 - 2010/08/15)</title><summary type='text'>青春18切符で京都と長野に行ってきました。とりあえず記録を残しておこう。  1日目  京都 夕食　錦魚亭 飲み　酒Bar よらむ 飲んだ酒  麒麟 時醸酒 十酒(とき) 1988 開春 純米蝶辛口 舞美人 純米 常温生熟 おりがらみ 能登 3年酒  宿泊：FIRST CABIN  2日目  京都 八坂神社 平安神宮 お神酒(橘酒)購入 吉田山 大文字の形は見えず 伏見稲荷大社 飲み たかはし (日本酒酒バー) 飲んだ酒  竹鶴(日本酒) 純米原酒 出置桜 強力 純米 竹鶴 純米吟醸 古酒 勝駒  宿泊:FIRST CABIN  3日目  京都 -&gt; 長野(岡谷) 岡谷太鼓祭り 宿泊:岡谷セントラルホテル  4日目  長野 諏訪大社 春宮、秋宮、前宮、本宮 北斗神社。本宮の近くの急な階段を昇ったところ。 日本酒購入@二葉屋酒店: 黒松仙醸 寒造り純米 新春仕込み だるま市しぼり(低温熟成)</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/5294390741185662373/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/08/20100811-20100815.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5294390741185662373'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5294390741185662373'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/08/20100811-20100815.html' title='旅行履歴(2010/08/11 - 2010/08/15)'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-2923797793306764361</id><published>2010-08-04T21:52:00.001+09:00</published><updated>2010-08-04T21:52:57.749+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='酒'/><title type='text'>本日の酒(2010/08/04)</title><summary type='text'>本日の酒は、はるばるドイツからやってきたビール、ヴァルシュタイナー。輸入してるのはアイコン・ユーロパブ株式会社というとこらしい。</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/2923797793306764361/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/08/20100804.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/2923797793306764361'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/2923797793306764361'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/08/20100804.html' title='本日の酒(2010/08/04)'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-2742118713665556002</id><published>2010-08-03T23:55:00.001+09:00</published><updated>2010-08-03T23:55:40.148+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='McCLIM'/><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><title type='text'>McCLIMで升目を描く</title><summary type='text'>formatting-tableを利用すれば良さそうだけど、無理やりな感じが現れてる。LispworksのCLIMのページを参考にした。 (asdf:oos 'asdf:load-op :mcclim);;(asdf:oos 'asdf:load-op :mcclim-truetype)(in-package :clim-user)(defun output-table (&amp;key (stream *standard-output*)		     inter-row-spacing		     inter-column-spacing)  (clim:formatting-table      (stream :x-spacing inter-row-spacing	      :y-spacing inter-column-spacing)    (dotimes (i 3)</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/2742118713665556002/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/08/mcclim.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/2742118713665556002'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/2742118713665556002'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/08/mcclim.html' title='McCLIMで升目を描く'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-1625037526939554568</id><published>2010-07-31T12:51:00.001+09:00</published><updated>2010-07-31T12:51:52.901+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Clojure'/><title type='text'>ClojureでBrainf*ck</title><summary type='text'>プログラミング言語の勉強する時は、  Hello World! FizzBuzz Brainfu*k というのを最初に書いてみることにしている。ClojureでもBrainfu*kを書いてみた。 (defstruct env :inst :pc :program :last :ptr :memory)(defmulti execute :inst)(defmethod execute \&gt; [{pc :pc ptr :ptr :as env}] ;increment pointer	   (merge env		  {:pc (inc pc),		   :ptr (inc ptr)}))(defmethod execute \&lt; [{pc :pc ptr :ptr :as env}] ;decrement pointer	   (merge env		  {:pc (inc pc),</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/1625037526939554568/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/07/clojurebrainfck.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/1625037526939554568'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/1625037526939554568'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/07/clojurebrainfck.html' title='ClojureでBrainf*ck'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-4435297316979331930</id><published>2010-07-29T00:37:00.001+09:00</published><updated>2010-07-29T00:37:26.215+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Clojure'/><title type='text'>clojureでコンパイル</title><summary type='text'>clojureのcompile関数をうまく動かすまでに結構手間取ったのでメモ 1. ソースの置かれているディレクトリ(パッケージのルートになるとこ)にクラスパスが通っている2. カレントディレクトリからみた出力先(*compile-path*)ディレクトリにクラスパスが通っている3. 出力先ディレクトリが存在する &lt;- ここ重要4. SLIME経由で使ってるなら、ただしくクラスパスが設定されるようになっているか注意する</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/4435297316979331930/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/07/clojure.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/4435297316979331930'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/4435297316979331930'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/07/clojure.html' title='clojureでコンパイル'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-5164146423953631960</id><published>2010-07-25T23:55:00.001+09:00</published><updated>2010-07-25T23:55:33.442+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ジンジャーエール'/><title type='text'>ジンジャーエールを作る-その1</title><summary type='text'>今日の昼食を食べた店で、自家製ジンジャーエールがあったので頼んでみたらおいしかった。自分でも作ってみたい、そしてそのジンジャーエールでモスコミュールを作りたい、と思った。レシピを調べて見たところ、割と皆さん自分の好きなように作っているっぽかったので、簡単そうなハチミツに付けるだけのものを試してみた。材料は  新ショウガ 150g (スライス) はちみつ ショウガが浸るくらい シナモン 粉の奴を大さじ1杯 これだけ。こいつを炭酸水で割るとジンジャーエールが出来上がるらしい。シナモンが多すぎるような気がするが、入れてしまったものはしかたない。これらを瓶の中にぶち込んで冷蔵庫で放置する。果たして、まともに飲めるものができるのだろうか。</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/5164146423953631960/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/07/1.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5164146423953631960'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5164146423953631960'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/07/1.html' title='ジンジャーエールを作る-その1'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-8678123099641866592</id><published>2010-07-18T15:21:00.001+09:00</published><updated>2010-07-18T15:21:46.182+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ELisp'/><category scheme='http://www.blogger.com/atom/ns#' term='Emacs'/><title type='text'>Emacs LispでファイルIOその2</title><summary type='text'>open,closeを書いたのでついでに with-open-fileも書いてみた。 (defmacro with-open-file (clause &amp;rest body)  (destructuring-bind      (direction filename stream)      (let ((tmp (reverse clause)))	(if (= (length tmp) 2)	    (cons :input tmp)	  tmp))    `(let ((,stream (open ,filename ,direction)))       (prog1	   (progn	     ,@body)	 (close ,stream)))))</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/8678123099641866592/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/07/emacs-lispio2.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/8678123099641866592'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/8678123099641866592'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/07/emacs-lispio2.html' title='Emacs LispでファイルIOその2'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-8555503242085547692</id><published>2010-07-18T12:29:00.001+09:00</published><updated>2010-07-18T12:29:27.337+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='McCLIM'/><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><title type='text'>McCLIMでグラフを書く</title><summary type='text'>McCLIMでグラフを描画する。ノードが循環すると繰り返し処理をしようとして落ちるようだ。 (require :asdf)(asdf:oos 'asdf:load-op :mcclim)(in-package :clim-user)(define-application-frame graph-frame ()  ()  (:menu-bar t)  (:panes   (app :application	:min-width 200	:min-height 200	:scroll-bars nil	:display-time :command-loop	:display-function 'draw))  (:layouts   (default (horizontally () app))))(define-graph-frame-command (com-quit :menu t)</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/8555503242085547692/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/07/mcclim.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/8555503242085547692'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/8555503242085547692'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/07/mcclim.html' title='McCLIMでグラフを書く'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-7748094012001246572</id><published>2010-07-18T10:52:00.001+09:00</published><updated>2010-07-18T10:52:06.822+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ELisp'/><category scheme='http://www.blogger.com/atom/ns#' term='Emacs'/><title type='text'>Emacs LispでファイルIO</title><summary type='text'>Emacs Lispで、ファイルから入力する処理をCommonLispのノリで書こうとしたら・・・ &gt;(require 'cl)&gt;(with-open-file (in "hoge.txt" :direction :input)   (with-open-file (out "fuga.txt" :direction :output)     (princ (read in) out)))Debugger entered--Lisp error: (void-function with-open-file)あれ? &gt;(open "hoge.txt")Debugger entered--Lisp error: (void-function open)・・・あれ?ELispってファイルオープンしてストリームを作ることができないのか・・・。調べて見たところ、streamとして使えるのは以下</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/7748094012001246572/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/07/emacs-lispio.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/7748094012001246572'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/7748094012001246572'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/07/emacs-lispio.html' title='Emacs LispでファイルIO'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-2574217487070460187</id><published>2010-05-19T00:29:00.001+09:00</published><updated>2010-05-19T00:29:57.069+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><title type='text'>ネストしたquasiquoteの悪夢</title><summary type='text'>S式 -&gt; Cのトランスレータを書こうと前々から思っていじってはいるが、結局うまい方法を思いつけずに挫折ということを繰り返している。今の考えはマクロ -&gt; make-instance -&gt; emitという流れにしようというもの。とりあえずマクロとオブジェクトの定義部分を書こうとして、自分でも理解しきれないネストしたquasiquoteを書いたのでネタとして載せておく。myパッケージは自分の使うOn LispやANSI Common Lispその他から拝借した関数などをまとめたパッケージ。 (cl:defpackage :trans  (:import-from :common-lisp &amp;optional &amp;rest &amp;body &amp;key))(in-package :trans)(cl:defun remove-lambda-keywords (lst)  (cl:mapcar   #'</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/2574217487070460187/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/05/quasiquote.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/2574217487070460187'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/2574217487070460187'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/05/quasiquote.html' title='ネストしたquasiquoteの悪夢'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-8972324446444469546</id><published>2010-05-18T21:04:00.001+09:00</published><updated>2010-05-18T21:04:40.427+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><title type='text'>リーダマクロでlambdaを短縮する</title><summary type='text'>Clojureでは無名関数を作るために用いるのは、lambdaでは無くfnという特殊式なため Common Lispより3文字短い。3文字程度なら良いのだけど、Clojureにはさらに無名関数のためのリーダマクロが用意されている。 ;;この式が#(list %1 %2);;こうなる(イメージ)(fn [%1 %2] (list %1 %2))Clojureに心引かれる箇所は色々あるけれど、このリーダマクロなら多少は自分で書いてみることができるのでは無いかと思ったので、試しに書いてみた。 展開されるようにした。また、引数は%nではなく$nで表現した。 (defun dollar-symbol-p (sym)  (and (symbolp sym) (char= #\$ (char (symbol-name sym) 0))))(defun dollar-symbol-index (sym)</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/8972324446444469546/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/05/lambda.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/8972324446444469546'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/8972324446444469546'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/05/lambda.html' title='リーダマクロでlambdaを短縮する'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-8741731619691763702</id><published>2010-04-19T23:28:00.002+09:00</published><updated>2010-04-19T23:30:22.486+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Android'/><category scheme='http://www.blogger.com/atom/ns#' term='Clojure'/><title type='text'>Clojure on AndroidでAlertDialog</title><summary type='text'>Xperiaを買ったのでClojure on Androidで遊ぼうとしている。JavaもClojureもAndroidも素人なのでいろんなとこで時間をくってるが、とりあえずボタンクリックでAlertDialogを表示するところまでいった。 (ns org.example.Test.AlertDialog(:gen-class :extends android.app.Activity :implements (android.view.View$OnClickListener) :exposes-methods {onCreate superOnCreate}))(import '(android.app AlertDialog) '(android.util Log))(defn -onCreate [this #^android.os.Bundle bundle]  (.</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/8741731619691763702/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/04/clojure-on-androidalertdialog.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/8741731619691763702'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/8741731619691763702'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/04/clojure-on-androidalertdialog.html' title='Clojure on AndroidでAlertDialog'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-4207119937107826531</id><published>2010-03-30T20:22:00.001+09:00</published><updated>2010-03-30T20:22:51.312+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='酒'/><category scheme='http://www.blogger.com/atom/ns#' term='酒屋'/><title type='text'>自宅にある日本酒リスト(2010/03/30)</title><summary type='text'>現在自宅にある日本酒一覧  九頭龍 大吟醸燗酒 (黒龍酒造株式会社/福井) 梵 特醸(磨き5割8分) (加藤吉平商店/福井) いづみ橋 とんぼラベル1号 (泉橋酒造株式会社/神奈川) 田ゆう 純米 (泉橋酒造株式会社/神奈川) 溪 純米吟醸 本生 (王祿酒造株式会社/島根) 溪 純米吟醸 にごり (王祿酒造株式会社/島根) 雪吟 吟醸純米生貯蔵酒 (桃川株式会社/青森) 九頭龍、いづみ橋、田ゆうは川崎の「地酒や たけくま酒店」にて購入。溪は父親がどこからか購入してきた。雪吟は大学の卒業式(学位授与式)後に後輩にもらった。梵は大学の友人にもらった。田ゆうは神奈川県海老名市にある泉橋酒造で作られたものだが、使用している米は川崎で取れたものとのこと。</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/4207119937107826531/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/03/20100330.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/4207119937107826531'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/4207119937107826531'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/03/20100330.html' title='自宅にある日本酒リスト(2010/03/30)'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-5417719812739305725</id><published>2010-03-28T21:47:00.001+09:00</published><updated>2010-03-28T21:47:42.133+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Clojure'/><title type='text'>ClojureでTwitter</title><summary type='text'>Clojureの練習がてらTwitterクライアントの作成を目指す。取り合えず、タイムラインを取得してJTableで表示してみた。 (require 'clojure.contrib.http.agent)(import java.net.URLEncoder sun.misc.BASE64Encoder)(import '(javax.swing.table AbstractTableModel))(def status-list (atom []))(defn seq-&gt;map [seq]  (reduce   (fn [map [key val]]     (assoc map key val))   {}   seq))(defn basic-authentication [id pass]  (str "Basic "       (.encode (BASE64Encoder</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/5417719812739305725/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/03/clojuretwitter.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5417719812739305725'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5417719812739305725'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/03/clojuretwitter.html' title='ClojureでTwitter'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-6536734303811178278</id><published>2010-03-27T11:42:00.001+09:00</published><updated>2010-03-27T11:42:45.814+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Clojure'/><title type='text'>Clojure始めました2</title><summary type='text'>Clojureをさわり始めたので、メモ。 ;;空白文字が入る箇所に,(カンマ)を入れても良い。;;rangeは[end] [start end] [start end step]の3パターンで利用できる.;;start(デフォルトは0)からstep(デフォルトは0)ずつend未満の値を集める(print (range 0 10))|(0 1 2 3 4 5 6 7 8 9)(print (range 0 10 2))|(2 4 6 8);;mapはシーケンスの各要素を引数として関数を呼び出した結果を集めて返す。;;無名関数はfnで作成できるが、省略記法として#(hoge %)のように;;作成することもできる。この時、%は第1引数を、%nは第n引数を表す。(map #(* % %) (range 10));;同様の処理はforでは以下のように書ける。;;forはループではなくリスト内包表記</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/6536734303811178278/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/03/clojure2.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/6536734303811178278'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/6536734303811178278'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/03/clojure2.html' title='Clojure始めました2'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-1269636869183539544</id><published>2010-03-22T15:11:00.001+09:00</published><updated>2010-03-22T15:11:49.031+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LISP'/><category scheme='http://www.blogger.com/atom/ns#' term='Clojure'/><category scheme='http://www.blogger.com/atom/ns#' term='Emacs'/><title type='text'>Clojure始めました</title><summary type='text'>土曜日(3/20)にShibuya.lisp#5に参加した。残念ながら予定があったので懇親会は不参加。毎度のことながらTT、LTの発表は濃かったりおもしろかったりで素晴らしかったですが、どうも今回はClojure祭り状態のようで、Lisperを目指しているくせに1度も触ったことのない私は精神的ダメージを負うことになったのでした。会場にオーム社の方々(らしい)が来ており、商魂たくましく(?)会場で書籍の販売を行っている中に狙いすましたかのように「プログラミングClojure」が置いてあったのでついうっかり購入してしまった。ということで、書籍を読みつつLispの最先端たるClojureを書いてみようと思う。Emacs使いたるもの、設定をせずにプログラミングを始めるというのはおそらくありえないので、 clojure-modeとswank-clojureの導入を行おうとした。</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/1269636869183539544/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/03/clojure.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/1269636869183539544'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/1269636869183539544'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/03/clojure.html' title='Clojure始めました'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-8435593844006656016</id><published>2010-03-17T22:12:00.001+09:00</published><updated>2010-03-17T22:12:20.493+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Automaton'/><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><title type='text'>regexp-&gt;list-&gt;nfa</title><summary type='text'>正規表現を文字列で考えていて頭がいたくなってきたので、一旦リストにしてからNFAにするようにしてみる。 ;;regexp-&gt;list(defun regexp-&gt;list (reg)  (let* ((top nil)	 (stack (list top)))    (loop :for ch across reg       :do       (case ch	 ((#\()	  (push top stack)	  (setf top nil))	 ((#\))	  (let ((prev (pop stack)))	    (push top prev)	    (setf top prev)))	 ((#\|)	   (setf top		 (list top :or)))	 ((#\*)	  (let ((tmp (list (pop top) :loop)))	    (</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/8435593844006656016/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/03/regexp.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/8435593844006656016'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/8435593844006656016'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/03/regexp.html' title='regexp-&amp;gt;list-&amp;gt;nfa'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-2625278843328726627</id><published>2010-03-17T19:37:00.001+09:00</published><updated>2010-03-17T19:37:09.798+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Automaton'/><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><category scheme='http://www.blogger.com/atom/ns#' term='cl-dot'/><title type='text'>NFAの状態遷移図をcl-dotで描画する</title><summary type='text'>正規表現からNFAへ変換処理をデバッグするときに、NFAの状態遷移図どのようになったかを知りたい。手書きするのも面倒くさくなってきたので、cl-dotで描画することにした。NFAは前回の記事の形式であるとする。cl-dotのノードや矢印に属性値を指定したい場合、元々のオブジェクトをattributedというクラスのオブジェクトでラップすれば良いようだ。 ;;;nfaの遷移図を描画(defparameter *table* nil)(defparameter *f* nil)(defun mklist (lst)  (if (listp lst) lst (list lst)))(defmethod cl-dot:graph-object-node ((graph (eql 'nfa)) (key symbol))  (make-instance 'cl-dot:node		 :</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/2625278843328726627/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/03/nfacl-dot.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/2625278843328726627'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/2625278843328726627'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/03/nfacl-dot.html' title='NFAの状態遷移図をcl-dotで描画する'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-2680472464895713177</id><published>2010-03-17T18:58:00.001+09:00</published><updated>2010-03-17T18:58:14.101+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Automaton'/><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><category scheme='http://www.blogger.com/atom/ns#' term='正規表現'/><title type='text'>正規表現からNFAを作る</title><summary type='text'>ドラゴンブックの字句解析の項目を参考に、正規表現を表す文字列からNFAを作る。 (defvar *label-count* 0);;遷移図で特殊な入力記号として用いるもの;; :epsilon イプシロン遷移;; :all 任意の1文字(defun mklist (obj)  (if (listp obj) obj (list obj)))(defmacro do-hash ((key val) table &amp;body body)  `(maphash    #'(lambda (,key ,val)	,@body)    ,table))(defun make-new-state ()  (incf *label-count*)  (intern (format nil "STATE-~A" *label-count*) :keyword))(defun get-states (</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/2680472464895713177/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/03/nfa.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/2680472464895713177'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/2680472464895713177'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/03/nfa.html' title='正規表現からNFAを作る'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-5431218448234501021</id><published>2010-03-16T21:49:00.001+09:00</published><updated>2010-03-16T21:49:33.207+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Modula3'/><title type='text'>Modula3でFizzBuzz</title><summary type='text'>Case文がパターンマッチっぽい. MODULE Main;IMPORT IO;BEGIN     FOR i := 1 TO 100 DO     	  CASE i MOD 15 OF     	  | 0 =&gt; IO.Put("FizzBuzz");	  | 3,6,9,12 =&gt; IO.Put("Fizz");	  | 5,10 =&gt; IO.Put("Buzz");	  ELSE	       IO.PutInt(i);	  END;	  IO.Put("\n");     END;END Main.</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/5431218448234501021/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/03/modula3fizzbuzz.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5431218448234501021'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/5431218448234501021'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/03/modula3fizzbuzz.html' title='Modula3でFizzBuzz'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-3704531624668081439</id><published>2010-03-16T13:37:00.001+09:00</published><updated>2010-03-16T13:37:41.774+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OS'/><category scheme='http://www.blogger.com/atom/ns#' term='PCI'/><title type='text'>PCIデバイスが存在するか確認する</title><summary type='text'>PCIデバイスがあるかどうか確認する。一応それっぽいデバイスが表示はされる。io_inXとio_outX,Printfが既に定義されているものとする。 io_inとio_outはそれぞれのビット数のin,out命令。 enum PCI_CONFIGURATION_REGISTER{	VenderID = 0x00, //bit0-15	DeviceID = 0x00, //bit16-32	CommandRegister = 0x04, //bit0-15	StatusRegister = 0x04, //bit16-32	RevisionRegister = 0x08, //bit0-7	ClassCode = 0x08, //bit8-31	CacheLineSize = 0x0C, //bit0-7	MasterLatencyTimer = 0x0C, //bit8-15	</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/3704531624668081439/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/03/pci.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/3704531624668081439'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/3704531624668081439'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/03/pci.html' title='PCIデバイスが存在するか確認する'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-7884172618930004339</id><published>2010-03-08T01:46:00.001+09:00</published><updated>2010-03-08T01:46:31.505+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Modula-3'/><category scheme='http://www.blogger.com/atom/ns#' term='LISP'/><title type='text'>Modula-3のSLisp</title><summary type='text'>Critical Mass Modula-3のライブラリにSLispというものがある。名前を見るにLispっぽいので使おうと試みる。ちなみに、m3makefileでimportに書く名前は、 modula3のディレクトリのpkgディレクトリのサブディレクトリの名前だと思う。 MODULE Main;IMPORT SLisp,Stdio,Rd,Wr,IO;VAR slisp :SLisp.T;VAR rd :SLisp.Reader;VAR wr :SLisp.Writer;BEGIN     rd := Stdio.stdin;     wr := Stdio.stdout;     slisp := NEW(SLisp.T);     slisp := slisp.new();     LOOP       SLisp.Write(wr ,slisp.eval(SLisp.Read(</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/7884172618930004339/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/03/modula-3slisp.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/7884172618930004339'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/7884172618930004339'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/03/modula-3slisp.html' title='Modula-3のSLisp'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-261310295976223518.post-4842376905814711596</id><published>2010-03-07T01:37:00.001+09:00</published><updated>2010-03-07T01:37:20.602+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='マクロ'/><category scheme='http://www.blogger.com/atom/ns#' term='CommonLisp'/><title type='text'>ラムダリストのwholeパラメータ</title><summary type='text'>CommonLispのマクロ定義に、&amp;wholeでパラメータを指定できる。どうやら式そのものが束縛されるようだ。 (defmacro hoge (&amp;whole call &amp;optional (from 0) (to 10))  `(progn     (print ',call)     (format t "from:~A -&gt; to:~A" ,from ,to)))&gt;(hoge 2 3)(HOGE 2 3) from:2 -&gt; to:3&gt;(macroexpand-1 '(hoge 2 3))(PROGN (PRINT '(HOGE 2 3)) (FORMAT T "from:~A -&gt; to:~A" 2 3))&gt;(hoge)(HOGE) from:0 -&gt; to:10&gt;(macroexpand-1 '(hoge))(PROGN (PRINT '(HOGE)) (FORMAT T "</summary><link rel='replies' type='application/atom+xml' href='http://kurohuku.blogspot.com/feeds/4842376905814711596/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://kurohuku.blogspot.com/2010/03/whole.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/4842376905814711596'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/261310295976223518/posts/default/4842376905814711596'/><link rel='alternate' type='text/html' href='http://kurohuku.blogspot.com/2010/03/whole.html' title='ラムダリストのwholeパラメータ'/><author><name>kurohuku</name><uri>http://www.blogger.com/profile/10828588302747950372</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
