{"id":37,"date":"2014-07-31T02:30:00","date_gmt":"2014-07-30T17:30:00","guid":{"rendered":"http:\/\/www.raythebm.net\/weblog\/?p=37"},"modified":"2015-02-18T10:12:44","modified_gmt":"2015-02-18T01:12:44","slug":"on-lisp-%e7%94%a8%e3%81%ae%e3%83%a6%e3%83%8b%e3%83%83%e3%83%88%e3%83%86%e3%82%b9%e3%83%88%e3%81%a7%e5%9b%b0%e3%81%a3%e3%81%9f%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/www.raythebm.net\/weblog\/archives\/37","title":{"rendered":"on lisp \u7528\u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u3067\u56f0\u3063\u305f\u4ef6"},"content":{"rendered":"<p>\u8cb7\u3063\u3066\u304b\u3089\u653e\u7f6e\u3057\u3066\u3042\u3063\u305f\u300cOn Lisp\u300d\u3092\u8aad\u307f\u59cb\u3081\u305f\u3093\u3067\u3059\u304c\u3001\u3069\u3046\u305b\u3060\u304b\u3089\u30b5\u30f3\u30d7\u30eb\u30bd\u30fc\u30b9\u7528\u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u3092\u66f8\u3044\u3066\u307f\u3088\u3046\u3068\u601d\u3063\u305f\u306e\u304c\u3001\u3053\u306e\u8a71\u306e\u59cb\u307e\u308a\u3067\u3059\u3002<\/p>\n<p>\u3068\u308a\u3042\u3048\u305a\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306b\u3064\u3044\u3066\u8abf\u3079\u56de\u3063\u3066\u3001FiveAM \u304c\u3044\u3044\u3093\u3058\u3083\u306a\u3044\u304b\u3068\u3044\u3046\u4e8b\u306b\u306a\u308a\u307e\u3057\u305f\u3002<br \/>\n\u6700\u521d\u306e\u65b9\u306f\u5927\u3057\u305f\u554f\u984c\u3082\u7121\u304f\u3001\u3059\u3089\u3059\u3089\u3068(\u2190\u4e00\u90e8\u8a87\u5f35\u3042\u308a)\u30c6\u30b9\u30c8\u3092\u66f8\u3051\u307e\u3057\u305f\u3002<br \/>\n\u3067\u3001\u30b3\u30f3\u30bd\u30fc\u30eb\u3068\u306e\u5165\u51fa\u529b\u3092\u884c\u3046\u30e6\u30fc\u30c6\u30a3\u30ea\u30c6\u30a3\u306e\u7ae0\u307e\u3067\u9032\u3093\u3060\u3068\u3053\u308d\u3067\u58c1(\u305f\u3076\u3093 Lisper \u306b\u306f\u8def\u80a9\u306e\u6bb5\u5dee\u7a0b\u5ea6)\u306b\u3076\u3064\u304b\u3063\u305f\u306e\u3067\u3059\u3002<br \/>\n<!--more--><\/p>\n<p>\u4ed6\u306e\u60c5\u5831\u6e90\u304b\u3089\u3001\u6a19\u6e96\u5165\u51fa\u529b\u3092\u6587\u5b57\u5217\u306b\u30ad\u30e3\u30d7\u30c1\u30e3\u3059\u308b\u65b9\u6cd5\u3092\u77e5\u3063\u3066\u307e\u3057\u305f\u306e\u3067\u3001\u3053\u306e\u30c6\u30b9\u30c8\u30b3\u30fc\u30c9\u3082\u4f59\u88d5\u3060\u3068\u3070\u304b\u308a\u306b\u66f8\u304d\u4e0a\u3052\u3066\u5b9f\u884c\u3057\u307e\u3057\u305f\u3002<br \/>\n\u305d\u306e\u7d50\u679c\u306f\u7121\u60e8\u306b\u3082\u7389\u7815\u3067\u3057\u305f\u3002\u305d\u3082\u305d\u3082\u5165\u51fa\u529b\u3092\u30ad\u30e3\u30d7\u30c1\u30e3\u3057\u3066\u3044\u308b\u306f\u305a\u306a\u306e\u306b\u3001\u3057\u3063\u304b\u308a\u30d7\u30ed\u30f3\u30d7\u30c8\u304c\u51fa\u3066\u30ad\u30fc\u30dc\u30fc\u30c9\u5165\u529b\u3092\u8981\u6c42\u3057\u305f\u306e\u3067\u3059\u3002<\/p>\n<p>\u305d\u306e\u5f8c\u3057\u3070\u3089\u304f\u306e\u9593\u3001\u3042\u30fc\u3067\u3082\u306a\u3044\u3053\u30fc\u3067\u3082\u306a\u3044\u3068\u8a66\u884c\u932f\u8aa4\u3057\u3066\u6ce3\u304d\u304c\u5165\u3063\u305f\u9803\u306b\u3001\u3075\u3068\u300cOn Lisp\u300d\u306e\u30bd\u30fc\u30b9\u306e\u65b9\u3092\u8aad\u307f\u8fd4\u3057\u305f\u3068\u3053\u308d\u3001\u898b\u4e8b\u306b\u539f\u56e0\u304c\u5224\u660e\u3057\u307e\u3057\u305f\u3002<br \/>\n\u51e6\u7406\u306b\u4f7f\u3063\u3066\u3044\u308b stream \u304c *standard-{in,out}put* \u3067\u306f\u306a\u304b\u3063\u305f\u306e\u3067\u3059\u3002<br \/>\n\u305d\u3053\u306b\u306f\u71e6\u7136\u3068 *query-io* \u306e\u6587\u5b57\u5217\u304c\u8f1d\u3044\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u308c\u304b\u3089\u66f4\u306b\u8a66\u884c\u932f\u8aa4\u3059\u308b\u3053\u3068\u5341\u6570\u5206\u3001\u3088\u3046\u3084\u304f\u76ee\u7684\u306e\u30b3\u30fc\u30c9\u304c\u51fa\u6765\u4e0a\u304c\u308a\u307e\u3057\u305f\u3002\u30dd\u30a4\u30f3\u30c8\u306f\u4e00\u5ea6 input,output \u306e stream \u3092\u4f5c\u6210\u3057\u3066\u304b\u3089\u3001\u305d\u308c\u3089\u3092 make-two-way-stream \u3067\u5408\u4f53\u3055\u305b\u3066 *query-io* \u306b(\u82e5\u5e72\u8a9e\u5f0a\u304c\u3042\u308a\u307e\u3059\u304c)\u4e0a\u66f8\u304d\u3059\u308b\u4e8b\u3067\u3057\u305f\u3002<br \/>\n\u52d5\u3044\u305f\u30bd\u30fc\u30b9\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<p><code>(5am:test test-prompt<br \/>\n(with-input-from-string (in \"3\")<br \/>\n(with-output-to-string (out)<br \/>\n(let ((*query-io* (make-two-way-stream in out)))<br \/>\n(5am:is (equal 3 (prompt \"Enter a number between ~A and ~A.&gt;&gt; \" 1 10) )))<br \/>\n(5am:is (string= (get-output-stream-string out)<br \/>\n\"Enter a number between 1 and 10.&gt;&gt; \")) )))<\/code><\/p>\n<p>\u3061\u306a\u307f\u306b\u3001\u3082\u3046\u4e00\u3064\u3082\u30c8\u30e9\u30d6\u3063\u305f\u306e\u3067\u3059\u304c\u3001\u306a\u3093\u3068\u304b\u4e0b\u306e\u30b3\u30fc\u30c9\u3067\u52d5\u304d\u307e\u3057\u305f\u3002\u30dd\u30a4\u30f3\u30c8\u306f *standard-output* \u306b\u4e0d\u8981\u306a\u30c6\u30ad\u30b9\u30c8\u304c\u5165\u308b\u306e\u3067\u3001\u30c6\u30b9\u30c8\u90e8\u5206\u306e\u51fa\u529b\u3092 *error-output* \u306b\u5207\u308a\u66ff\u3048\u3066\u304a\u304d\u3001\u305d\u3061\u3089\u306e\u5185\u5bb9\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3066\u3044\u308b\u4e8b\u3067\u3059\u3002<\/p>\n<p><code>(5am:test test-break-loop<br \/>\n(with-input-from-string (in \"(+ 2 3)<br \/>\n:q<br \/>\n\")<br \/>\n(with-output-to-string (out)<br \/>\n(let ((*query-io* (make-two-way-stream in out))<br \/>\n(*error-output* (make-string-output-stream)))<br \/>\n(break-loop #'(lambda (x) (format *error-output* \"~A\" x))<br \/>\n#'(lambda (x) (equal x :q)) \"&gt;&gt; \")<br \/>\n(5am:is (string= (get-output-stream-string *error-output*)<br \/>\n\"(+ 2 3)\"))<br \/>\n))))<\/code><\/p>\n<p>\u2026\u6b21\u306b\u4f7f\u3046\u6642\u306b\u306f\u9593\u9055\u3044\u7121\u304f\u5fd8\u308c\u3066\u307e\u3059\u306d\u3001\u3053\u308c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8cb7\u3063\u3066\u304b\u3089\u653e\u7f6e\u3057\u3066\u3042\u3063\u305f\u300cOn Lisp\u300d\u3092\u8aad\u307f\u59cb\u3081\u305f\u3093\u3067\u3059\u304c\u3001\u3069\u3046\u305b\u3060\u304b\u3089\u30b5\u30f3\u30d7\u30eb\u30bd\u30fc\u30b9\u7528\u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u3092\u66f8\u3044\u3066\u307f\u3088\u3046\u3068\u601d\u3063\u305f\u306e\u304c\u3001\u3053\u306e\u8a71\u306e\u59cb\u307e\u308a\u3067\u3059\u3002 \u3068\u308a\u3042\u3048\u305a\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306b\u3064\u3044\u3066\u8abf\u3079\u56de\u3063\u3066\u3001Fi &hellip; <a href=\"https:\/\/www.raythebm.net\/weblog\/archives\/37\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[19,14],"class_list":["post-37","post","type-post","status-publish","format-standard","hentry","category-it","tag-lisp","tag-memo"],"_links":{"self":[{"href":"https:\/\/www.raythebm.net\/weblog\/wp-json\/wp\/v2\/posts\/37","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.raythebm.net\/weblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.raythebm.net\/weblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.raythebm.net\/weblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.raythebm.net\/weblog\/wp-json\/wp\/v2\/comments?post=37"}],"version-history":[{"count":4,"href":"https:\/\/www.raythebm.net\/weblog\/wp-json\/wp\/v2\/posts\/37\/revisions"}],"predecessor-version":[{"id":143,"href":"https:\/\/www.raythebm.net\/weblog\/wp-json\/wp\/v2\/posts\/37\/revisions\/143"}],"wp:attachment":[{"href":"https:\/\/www.raythebm.net\/weblog\/wp-json\/wp\/v2\/media?parent=37"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.raythebm.net\/weblog\/wp-json\/wp\/v2\/categories?post=37"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.raythebm.net\/weblog\/wp-json\/wp\/v2\/tags?post=37"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}