Source of Nothingness - lis

* Menu

[[About:self:AboutPage.txt]] | [[Profile:file/southly/]] | [[まとめ:self:1163859357.txt]] | [[オリジナル:http://ninjinix.x0.com/rn/]] | [[xyzzy:lisp/]] | [[あんてな:listall]] | [[■:lisp]] | [[buzz:files/southly#buzz]]

* 2008-03-12 :

(defun foo (i l)
  (if (>= i 5)
      l
    (foo (1+ i) (cons (lambda () i) l))))
(mapcar #'funcall (foo 0 nil))
=>(4 3 2 1 0)

* Common Lisp : xmls & s-xml と日本語

xmls で日本語を出力するには、write-escaped を修正する。
例えば以下のような感じ。
(in-package :xmls)
(defun write-escaped (string stream)
  "Writes string to stream with all character entities escaped."
  (coerce string 'simple-base-string)
  (when (eq stream t) (setf stream *standard-output*))
  (loop for char across string
        for esc = (if (< (char-code char) (length *char-escapes*))
                      (svref *char-escapes* (char-code char))
                      (string char))
        do (write-sequence esc stream)))
ただ、xmls で出力した xml はあんまり見慣れない書き方になるみたいなので使わない気がする。

s-xml の場合は print-string-xml に手を入れればいいと思う。
が、どの範囲をそのまま出力するようにするかが悩ましい。
UTF-8で出力することが前提ならなら ASCII 以上は全部でも良いとは思うけど、文字コード・文字集合辺りはよく分からないなあ。(上のはASCII以上全部になっているし)

* 2008-03-09 :

[[(ReadMore...) index.rb?1205059356.txt]]

* 2008-03-08 :

* 2008-03-06 :

* 2008-03-05 :