復習

anarchy golf - Goldbach partition

匠の仕事にたんぽぽを乗せるお仕事。#n=の理解が間違っていたので

if(every'p #1=`(,p,(- n p)))nconc #1#
↓
if(every'p`#1=(,p,(- n p)))nconc`#1#

の変形はエラーになるだろなーとか思ってた。このリーダーマクロを再定義しろとか言われても書ける自信がない…

anarchy golf - asunder

both-case-pとかいうトリビアっぽい関数を見つけたのは良かったっぽい。この問題もこれで解決かなと一瞬思ったけどだめだった。

(defun test (str)
  (map () (lambda (c)
    (format t "~&~C: alpha-char =>~A, both-case =>~A"
              c (alpha-char-p c) (both-case-p c))) str))

* (test "ゎぃゎヵッォゃ")

ゎ: alpha-char =>T, both-case =>NIL
ぃ: alpha-char =>T, both-case =>NIL
ゎ: alpha-char =>T, both-case =>NIL
ヵ: alpha-char =>T, both-case =>NIL
ッ: alpha-char =>T, both-case =>NIL
ォ: alpha-char =>T, both-case =>NIL
ゃ: alpha-char =>T, both-case =>NIL
NIL
* (test "〓〓〓〓〓〓")

〓: alpha-char =>T, both-case =>T
〓: alpha-char =>T, both-case =>T
〓: alpha-char =>T, both-case =>T
〓: alpha-char =>T, both-case =>T
〓: alpha-char =>T, both-case =>T
〓: alpha-char =>T, both-case =>T
NIL

文字化けしてるのはウムラウト(ÄäÖöÜü)。pre記法内にはどう書けばいいんだこれ。
ちなみにclisp, sbclともに同じ結果。

anarchy golf - Expression for appreciation

1の並べ方

(dotimes(i 10)(format t"~B~%"(1-(expt 2(1+ i)))))
(dotimes(i 10)(format t"~B~%"(1-(ash 2 i))))
(dotimes(i 10)(format t"~V@{1~}~%"(1+ i)t))
(dotimes(i 10)(format t"~V,'1D~%"(1+ i)1))

1234... は、そうか、subseqか...

anarchy golf - seq

prognの代わりにifが使える事を覚えた。しかしuptoとか一体どこから出てきたのか不明。普段絶対使わない、というか初めて使った気がする。

anarchy golf - Sum of Divisors for OCaml Golf Competition

if句とwhen句の違いはこれから調べる。
OCamlまったく読めないけど楽しそうだなあ。