2009-08-01から1ヶ月間の記事一覧

*evalhook* とか applyhook とか

CLtL2 20.1. Run-Time Evaluation of Forms 変数 *evalhook* 関数を突っ込んでおくと、なんらかの式を評価するときに実際に評価する代わりに *evalhook* に設定された関数が呼び出される。引数として以下の2つが与えられる。 本来評価する式 environment obj…

format の "~n@A"

;;; on xyzzy * (format t "~10A" :foo) foo => nil * (format t "~10@A" :foo) foo => nil * (format t "~10A" "foo") foo => nil * (format t "~10@A" "foo") foo => nil @ つけると string => 左 symbol => 右 ;;; on SBCL * (format t "~10A" :foo) FOO …

#4 make-instance

ちゃんと profile とかしてないんだが、どうも generic-function の呼び出しがネックな気がする。 (make-instance 'foo :key <value>) が ;;; 0 (defmethod make-instance ((class symbol) &rest initargs) (apply #'make-instance (find-class class) initargs)) ;</value>…

structure の print-function (2)

なんか xyzzy のソースいぢって structure を ~S で format したときも print-function 呼ぶようにしてしまった。closette を byte-compile すると落ちるのを調べるのに デバッグ用のxyzzyにアタッチして、ステップ実行 してみたんだけど、VS の使い方がよく…

#3 たらい回してみた

半端に compile するだけでもだいぶマシだけど、それでも200倍か・・・。 -- (tak 12 6 0) (tak 12 6 1) 遅さ defun 0.203 0.063 --- defmethod 508.641 128.438 2505, 2038 defmethod(compile 後) 46.25 12.204 227, 193 ;;; 生の xyzzy-lisp (defun tak (x …

#2 structure の print-function (1)

xyzzy だと ~A のときだけ print-function 使って出力する。~S のときは #S notation になる。今までそーゆーもんだと思ってたけど、sbcl は print-function 指定しておけばどっちでも print-function 使って出力してくれる。closette でけっこー入り組んだ …

structure の constructor の引数

;;; :constructor オプションに slot 名を指定しておくと * (defstruct (s1 (:constructor s1 (value))) value) => #<structure-definition: s1> ;;; こう呼び出せる * (s1 "value") => #S(s1 value "value") ただし標準の constructor("make-")とは違う名前じゃないとダメらしい。</structure-definition:>

#1 (defun (setf ) ...)

CLOS に興味がわいた、というか欲しくなった closette というのは CLOS の subset らしい 見てみたら2000行ちょいくらいだった ふるい common-lisp らしいので読めそうな雰囲気だった 「誰か移植しないかな」とかどっかで見かけた とゆーわけでやってみる。…

handler-case が bug ってる?

lisp/handler.l を読んでたら :no-error なんてものを使えることを知って使ってみたら compile するとおかしくなってしまった。 ;;; 再現用関数 * (defun test (x) (handler-case x (:no-error (x) x))) => test ;;; ここまではダイジョブ * (test 3) => 3 *…

major-mode のつくり方 -- 調査中 #1

major-mode というのは current buffer に対していろいろする関数。以下の「major-mode を適用するときに...」という部分はこの関数でやる。 (defun example-mode () (interactive) ...) お約束: 既存の buffer-local 変数、モード名、buffer-mode 変数 関数…

23: Creating multiple pages with navigation menus

http://dev.opera.com/articles/view/23-creating-multiple-pages-with-navigat/ Your HTML menu tools -- links, anchors and lists やり方は色々あるが、いずれにしろ link と a elements を使う。 link elements は documents 間の関係を表す。user agent…

22: Generic containers --- the div and span element

http://dev.opera.com/articles/view/22-generic-containers-8212-the-div-and/ Semantically neutral HTML には2つ意味を持たない element がある。HTML の仕様によれば The div and span elements, in conjunction with the id and class attributes, offe…

21: Lesser-know semantic elements

http://dev.opera.com/articles/view/21-lesser-known-semantic-elements/ Highlighting contact information address element は最もおかしな名前を与えられ誤解されている element かもしれない。 この element の意味はページ(あるいはその一部)を書い…

20: HTML forms --- the basics

あまりに長いので最終形態以外のコードは削除することにした。 http://dev.opera.com/articles/view/20-html-forms-the-basics/ Step one: The basic code 簡単なコメントフォームから<form> と </form> があって、その間にいろいろと。 form element: フォームは全てこの…

19: HTML tables

http://dev.opera.com/articles/view/19-html-tables/ The most basic table <table> <tr> <td>Volcano Name</td> <td>Location</td> <td>Last Major Eruption</td> <td>Type of Eruption</td> </tr> <tr> <td>Mt. Lassen</td> <td>California</td> <td>1914-17</td> <td>Explosive Eruption</td> </tr> ... </table> 上記の H…

18: HTML links - let's build a web!

http://dev.opera.com/articles/view/18-html-links-let-s-build-a-web/ What are links? 他のリソース(他の HTML documents、テキストファイル、PDFなど)を指すもの。ブラウザが自動的に追いかける link elements によるリンクと、ユーザーが選択して追う…

car とか cdr とか caddar とかの読み方

twitter での会話を勢いで実装してみた。 最初の ca は「か」、cd は「くだ」 その後は a は「あ」、d は「だ」 最後の r は「ー」 (defun pronounce (function) (let ((name (coerce (symbol-name function) 'list))) (unless (and (eql (first name) #\c) …

17: Images in HTML

http://dev.opera.com/articles/view/17-images-in-html/ A picture says more than a thousand words --or does it? ケータイとかでは画像は表示されないかもしれない ユーザは目が見えないとかで画像を見ることができないかもしれない 異文化圏の人にはそ…

16: HTML lists

The three list types 3種類ある unoredered list - いくつかのアイテムを順番関係なくまとめる ordered list - いくつかのアイテムを順番通りにまとめる definition list - name/value のペア, 用語とその定義や日時とイベントなど Unoredered lists "bulle…

15: Marking up textual content in HTML

HTML を使って文書の中身の意味を記述する方法。 Spaces - the final frontier 空白文字(スペース、タブ、改行など)について。HTML では連続した空白文字は、ひとつのスペースとして扱われる。 たとえば <h3>In the beginning</h3> は、以下と同等に扱われる。 <h3>In t</h3>…

14: Choosing the right doctype

ホントは "Choosing the right doctype for your HTML documents" The doctype comes first あらゆる HTML document の最初には DTD declaration(="doctype")を置く。 DTD Document Type Definition: どんな elements や attributes を許可する HTML なの…

どこの .xyzzy を読んでるか確認する

こないだ twitter で xyzzy の設定で困ってるっぽい人がいたので .xyzxy に (msgbox "hello") とか書いといて、ちゃんと.xyzzy 読んでるか確認してみては とだけ言って寝ちゃったんだけど、その後ちゃんとできたみたい でよかったよかった。せっかくなので、…

LDR で entry title 内の が消えてた

のでまさかと思って script タグ仕込んでみたけど何も起きなかった。えがったえがった。 &lt; とか書いとけばちゃんと表示されるみたい。ってゆーか、はてダ更新して1分くらいで LDR に出てくるってなにげにすごくね?

13: The HTML element

既に知ってることを読んでて「はいはいはいはい」とか思うのをグッとこらえるのがしんどい。はてダって < とかは &lt; って書かないとダメなのね。 Introduction head element のお勉強をします。 Head? What head are we talking about? 前に言ったとおり v…

12. The basic of HTML

Web Design Concepts のとこは後で読むことに。 What HTML is "HyperText Markup Language" web documents 用の言語 ドキュメントの一部を user agent がどう解釈するか、という情報*1 user agent != web browser web browser は user agent Google や Yahoo…

The Web Standard Curriculum

OperaWSC 目次 http://bowbow99.sakura.ne.jp/ があんまりにもあんまりなのでちゃんとしたサイト作ろうと思ったのだけど、XHTML とかよくわかんないのでちゃんと勉強することにした。