Next: , Previous: Input Functions, Up: Read and Print   [Contents][Index]


18.4 ½ÐÎÏ¥¹¥È¥ê¡¼¥à

½ÐÎÏ¥¹¥È¥ê¡¼¥à¤Ïɽ¼¨¤ÇÀ¸À®¤·¤¿Ê¸»ú·²¤ò¤É¤Î¤è¤¦¤Ë°·¤¦¤«¤ò»ØÄꤷ¤Þ¤¹¡£ ¤Û¤È¤ó¤É¤Îɽ¼¨´Ø¿ô¤Ï¾Êά²Äǽ¤Ê°ú¿ô¤È¤·¤Æ½ÐÎÏ¥¹¥È¥ê¡¼¥à¤ò¼õ¤±ÉÕ¤±¤Þ¤¹¡£ ½ÐÎÏ¥¹¥È¥ê¡¼¥à¤È¤·¤Æ»È¤¨¤ë·¿¤Ï°Ê²¼¤Î¤È¤ª¤ê¤Ç¤¹¡£

buffer

½ÐÎÏʸ»ú¤Ï¥Ð¥Ã¥Õ¥¡buffer¤Î¥Ý¥¤¥ó¥È°ÌÃÖ¤ËÁÞÆþ¤µ¤ì¤ë¡£ ʸ»ú¤¬ÁÞÆþ¤µ¤ì¤ë¤¿¤Ó¤Ë¥Ý¥¤¥ó¥È°ÌÃ֤Ͽʤá¤é¤ì¤ë¡£

marker

½ÐÎÏʸ»ú¤Ï¥Þ¡¼¥«marker¤¬¤¢¤ë¥Ð¥Ã¥Õ¥¡¤Î¥Þ¡¼¥«°ÌÃÖ¤ËÁÞÆþ¤µ¤ì¤ë¡£ ʸ»ú¤òÁÞÆþ¤¹¤ë¤¿¤Ó¤Ë¥Þ¡¼¥«°ÌÃ֤Ͽʤá¤é¤ì¤ë¡£ ¥¹¥È¥ê¡¼¥à¤¬¥Þ¡¼¥«¤Ç¤¢¤ë¤È¤­¤Ë¤Ï¡¢¥Ð¥Ã¥Õ¥¡¤Î¥Ý¥¤¥ó¥È°ÌÃ֤ϱƶÁ¤»¤º¡¢ ¤³¤Î¼ï¤Îɽ¼¨¤Ç¤Ï¥Ý¥¤¥ó¥È¤ò°Üư¤·¤Ê¤¤¡£

function

½ÐÎÏʸ»ú¤Ï´Ø¿ôfunction¤ËÅϤµ¤ì¡¢¤³¤Î´Ø¿ô¤¬Ê¸»ú¤ÎÊݸ¤ËÀÕǤ¤ò»ý¤Ä¡£ 1¤Ä¤Îʸ»ú¤ò°ú¿ô¤È¤·¤Æ½ÐÎϤ¹¤ëʸ»ú¿ô¤Î²ó¿ô¤À¤±¸Æ¤Ó½Ð¤µ¤ì¡¢ ÆÉ¼Ô¤Î˾¤à¾ì½ê¤Ëʸ»ú¤òÊݸ¤¹¤ëÀÕǤ¤ò»ý¤Ä¡£

t

½ÐÎÏʸ»ú¤Ï¥¨¥³¡¼Îΰè¤Ëɽ¼¨¤µ¤ì¤ë¡£

nil

½ÐÎÏ¥¹¥È¥ê¡¼¥à¤È¤·¤Ænil¤ò»ØÄꤹ¤ë¤È¡¢ standard-output¤ÎÃͤò¤«¤ï¤ê¤Ë»È¤¦¤³¤È¤ò°ÕÌ£¤¹¤ë¡£ ¤½¤ÎÃͤϥǥե©¥ë¥È½ÐÎÏ¥¹¥È¥ê¡¼¥à¤Ç¤¢¤ê¡¢ nil°Ê³°¤Ç¤¢¤ë¤³¤È¡£

symbol

½ÐÎÏ¥¹¥È¥ê¡¼¥à¤È¤·¤Æ¤Î¥·¥ó¥Ü¥ë¤Ï¡¢ ¤½¤Î¥·¥ó¥Ü¥ë¤Î¡Ê¤¢¤ì¤Ð¡Ë´Ø¿ôÄêµÁ¤ÈÅù²Á¤Ç¤¢¤ë¡£

ÀµÅö¤Ê½ÐÎÏ¥¹¥È¥ê¡¼¥à¤Î¿¤¯¤Ï¡¢ÆþÎÏ¥¹¥È¥ê¡¼¥à¤È¤·¤Æ¤âÀµÅö¤Ç¤¹¡£ ÆþÎÏ¥¹¥È¥ê¡¼¥à¤È½ÐÎÏ¥¹¥È¥ê¡¼¥à¤Î°ã¤¤¤Ï¡¢ ¥ª¥Ö¥¸¥§¥¯¥È·¿¤Î°ã¤¤¤È¤¤¤¦¤è¤ê¤Ï¡¢ ÆÉ¼Ô¤¬Lisp¥ª¥Ö¥¸¥§¥¯¥È¤ò¤É¤Î¤è¤¦¤Ë»È¤¦¤«¤Ç¤¹¡£

¥Ð¥Ã¥Õ¥¡¤ò½ÐÎÏ¥¹¥È¥ê¡¼¥à¤È¤·¤Æ»È¤Ã¤¿Îã¤ò¼¨¤·¤Þ¤¹¡£ ¥Ý¥¤¥ó¥È¤Î½é´ü°ÌÃ֤ϰʲ¼¤Ë¼¨¤¹¤è¤¦¤Ë‘the’¤Î‘h’¤ÎľÁ°¤Ë¤¢¤ê¤Þ¤¹¡£ ½ªÎ»¸å¤Ç¤â¡¢¥Ý¥¤¥ó¥È¤ÏƱ¤¸‘h’¤ÎľÁ°¤Ë°ÌÃÖ¤·¤Æ¤¤¤Þ¤¹¡£

---------- Buffer: foo ----------
This is t∗he contents of foo.
---------- Buffer: foo ----------
(print "This is the output" (get-buffer "foo"))
     ⇒ "This is the output"

---------- Buffer: foo ----------
This is t
"This is the output"
∗he contents of foo.
---------- Buffer: foo ----------

¤Ä¤®¤Ï¡¢¥Þ¡¼¥«¤ò½ÐÎÏ¥¹¥È¥ê¡¼¥à¤È¤·¤ÆÍѤ¤¤¿Îã¤Ç¤¹¡£ ¥Ð¥Ã¥Õ¥¡foo¤Î¥Þ¡¼¥«¤Î½é´ü°ÌÃ֤ϡ¢ ñ¸ì‘the’¤Î‘t’¤È‘h’¤Î¤¢¤¤¤À¤Ë¤¢¤ê¤Þ¤¹¡£ ½ªÎ»¸å¤Ë¤Ï¡¢¥Þ¡¼¥«¤ÏÁÞÆþ¤·¤¿¥Æ¥­¥¹¥È¤ò±Û¤¨¤ÆÆ±¤¸‘h’¤ÎľÁ°¤Ë°ÌÃÖ¤·¤Þ¤¹¡£ ¥Ý¥¤¥ó¥È°ÌÃ֤Ϥʤó¤Î±Æ¶Á¤â¤Ê¤¤¤³¤È¤ËÃí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡£

---------- Buffer: foo ----------
This is the ∗output
---------- Buffer: foo ----------
(setq m (copy-marker 10))
     ⇒ #<marker at 10 in foo>
(print "More output for foo." m)
     ⇒ "More output for foo."
---------- Buffer: foo ----------
This is t
"More output for foo."
he ∗output
---------- Buffer: foo ----------
m
     ⇒ #<marker at 34 in foo>

¤Ä¤®¤Ï¡¢¥¨¥³¡¼ÎÎ°è¤Ø¤Î½ÐÎϤÎÎã¤Ç¤¹¡£

(print "Echo Area output" t)
     ⇒ "Echo Area output"
---------- Echo Area ----------
"Echo Area output"
---------- Echo Area ----------

ºÇ¸å¤Ï¡¢´Ø¿ô¤ò½ÐÎÏ¥¹¥È¥ê¡¼¥à¤È¤·¤Æ»È¤Ã¤¿Îã¤ò¼¨¤·¤Þ¤¹¡£ ´Ø¿ôeat-output¤ÏÍ¿¤¨¤é¤ì¤¿Ê¸»ú¤ò¼õ¤±¼è¤ê¡¢ ¤½¤ì¤ò¥ê¥¹¥Èlast-output¤ÎÀèÆ¬¤Ë¥³¥ó¥¹¤·¤Þ¤¹ ¡Êsee Building Lists¡Ë¡£ ½ªÎ»¸å¤Ë¤Ï¡¢¥ê¥¹¥È¤¬¤¹¤Ù¤Æ¤Î½ÐÎÏʸ»ú¤òÊÝ»ý¤·¤Æ¤¤¤Þ¤¹¤¬µÕ½ç¤Ç¤¹¡£

(setq last-output nil)
     ⇒ nil
(defun eat-output (c)
  (setq last-output (cons c last-output)))
     ⇒ eat-output
(print "This is the output" 'eat-output)
     ⇒ "This is the output"
last-output
     ⇒ (10 34 116 117 112 116 117 111 32 101 104 
    116 32 115 105 32 115 105 104 84 34 10)

¥ê¥¹¥È¤Î½çÈÖ¤òµÕ¤Ë¤¹¤ì¤ÐÀµ¤·¤¤½ç½ø¤Î½ÐÎϤˤʤê¤Þ¤¹¡£

(concat (nreverse last-output))
     ⇒ "
\"This is the output\"
"

concat¤ò¸Æ¤Ó½Ð¤·¤Æ¥ê¥¹¥È¤òʸ»úÎó¤ËÊÑ´¹¤·¡¢ ÆâÍÆ¤òÆÉ¤ß¤ä¤¹¤¤¤è¤¦¤Ë¤·¤Þ¤·¤¿¡£


Next: , Previous: Input Functions, Up: Read and Print   [Contents][Index]