Lisperã¯ãªãLispãèªã¿ããããæ¸ããããã¨æãã®ãï¼
ã¾ãããªãã¨ããããLispãã¿ã§ããã¯ãã
æ¬å¼§ã®ããã§æ«æããï¼
ãªãããããã話ãããèããã¶ã£ã¡ãããããªããã¡ããã¨çé¢ç®ã«èªãã§ãªãããã§ã¯ï¼ã¨ãæã£ããããã®ã ããã¾ãããã¯ç½®ãã¦ãããã
è¦ã¯ãæ¬å¼§ãå¤éãã¦ãã«ãã³ã¨ã³ãã«ã®å¯¾å¿ãåããªãã¨ãããããããªï¼æ«æããçç±ã¨ãã¦ã¯ãä½ã¨ãªãæãã®ã
ã¨ãã£ã¿ãè¯ããªã
å¤ãã®å ´åã³ã¬ã ã¨æãããã¨
æ¸ãæ¹ãè¯ããªã
ã¾ãã³ã¬ããããããå°å³ã«å ¨ç¶ã¤ã³ãã³ããã¦ãªãã£ãããããããããèªã¿ã«ããã§ããã
大å¦ã®ã»ã³ã»ã®æãæ¹ãè¯ããªãï¼
ç¥ããï¼
Lisper ãLispã¯èªã¿ãããï¼ã
Lisperã¯å¤åã¿ããªããLispã®èªã¿ããããã¨æãã ããã@valvallowãããããããã¤ãå«ãã§ããã
æ«æçç¶ï¼
âLisperããLispãèªã¿ããããã¨è¨ãã®ã¯ãLispç ã®æ«æçç¶ã§ããï¼(?) "ã¨ã®ãã¨ãç¥ããããªã
ã¾ããLispç ã«ã¯å¥åº·çãªè¢«å®³ã¯å ¨ããªãããã ããã ã£ããããªããLispç ã«æãã£ã¦ã¿ãã°ããï¼ã¤ã¾ã
ã¿ããªã§Lispç ã«æããã°ãããã ï¼
Lispãèªã¿ãããçç±ãæ¸ããããçç±
ãããããªãã§ã¿ããªãã¢ã¤ã¨è¨ãã®ãï¼
ã ããããLispã«çã人ã«ãLispããã¢ã¤çç±ãèãã°ä»¥ä¸ã®2ã¤ã®çç±ãæãã¦ãããã ã
- ãæ¬å¼§ãå¤ãããã
- åç½®è¨æ³ã ãã
ããããããã«ã¯åã¯åè«ããããããããæ¬å¼§ãå¤ãããåç½®è¨æ³ãã¯ããããLispã®å©ç¹ãªã®ã ï¼
ä¸å¤è¨æ³ã¯ãã¿ã«ããï¼
åã¯ããä¸ç½®è¨æ³ãã¯èªã¿ã«ããã¨æãããªããï¼ä¸ç½®è¨æ³ãããææ§ã«ããåå ã ããã ï¼
ããããããä¸ç½®è¨æ³ããå®è£ ãããã®ã¯æ°å¦ã®å æ¸ä¹é¤ã«ããã¨ãããå¤ããæ®æ®µæ°å¦ã§ã¯ä¸ç½®è¨æ³ã§æ¼ç®ãããã ããããã°ã©ã ã§ãåæ§ã«è¡¨ç¾ããã欲æ±ããã£ã¦ãä¸ç½®è¨æ³ãç¨ããã¨æãã
1 + 2 * 3 + 4 - 5 / 6
ããããã©ãã ããï¼æ°å¦çã«è¡¨ç¾ããããããã¨ããç®çã®ããã ãã«ä¸ç½®è¨æ³ãç¨æããã®ãï¼ã¨æããã¶ã£ã¡ãããå æ¸ä¹é¤ã®è¡¨ç¾ã ããèªã¿ããããªã£ãã ãã®ããã«æãã
ä¸æ¹ãä¸ç½®è¨æ³ã¯æ§ææ¨ããã¯é ã表ç¾ã§ãããåç½®è¨æ³ã¨æ¯ã¹ã¦ãè¨ç®å¼ãè¦ã¦ãæ§ææ¨ãæ§ç¯ããã®ã¯å¤§å¤ã ã¨æãã
以ä¸ã®ã³ã¼ããè¦ã¦ã»ãããrubyã§å®è¡ããã¨3ãè¿ã£ã¦ãã
1 + 2 * 3 + 4 == 1 + 2 / 5 && 10 <= 10 + 20 || 1 + 2
ããã¯é常ã«èªã¿ã«ããã¨æãããªãèªã¿ã«ããã®ã ãããï¼
æ§ææ¨ã®æ ¹ãåããè¾ãããã ã
åç½®è¨æ³çã«æ¸ãæãã¦ã¿ãã
|| && == + + 1 * 2 3 4 + 1 / 2 5 <= 10 + 10 20 + 1 2
ãããã大åãã¢ã¤ããå°ãªãã¨ããä¸çªå·¦ã®æ¼ç®ãæ§ææ¨ã®æ ¹ã®æ¼ç®ã¨è¨ããã¨ã¯ç解ã§ããã
ããã«ã¯ããä¸ã¤éè¦ãªç¹ããããåç½®è¨æ³ã¯æ¼ç®ã®åªå é ä½ãªãã¦å¿ è¦ããªãã®ã ï¼éã«ããã°ãä¸ç½®è¨æ³ã¯æ¼ç®ã®åªå é ä½ãèããªããã°ãªããªããããã¯ãå®è£ ããå´ã«ã¨ã£ã¦ããå©ç¨ããå´ã«ã¨ã£ã¦ã大ããªè² æ ã«ãªããå®è£ ããå´ã¯èªç¶ãªåªå é ä½ãèããªãã¨ãããªãããå©ç¨è ã¯åªå é ä½ãè¦ããªãã¨ãããªãããã ï¼
æ¬å¼§ã¯ããèªã¿ãããããããã«åå¨ãã
ããã¯ä¸å¤è¨æ³ã§ãã£ã¦ããåç½®è¨æ³ã§ãã£ã¦ãåæ§ã ã¨æãã
((1 + 2 * 3 + 4) == (1 + 2 / 5) && (10 <= 10 + 20)) || (1 + 2)
ä¸ç¬ã§æ¨ãè¦ããããã«ãªã£ãã®ã§ã¯ãªãã ãããï¼
ãã£ãã®ãåç½®è¨æ³ã«æ¬å¼§ãä»ãã¦ã¿ãã
(|| (&& (== (+ (+ 1 (* 2 3)) 4) (+ 1 (/ 2 5)) (<= 10 (+ 10 20) ) (+ 1 2))
ãã¢ã¤ãã ããããã«åç½®è¨æ³ã«ã¤ã³ãã³ããä»ãããã©ãã ãããï¼
(|| (&& (== (+ (+ 1 (* 2 3)) 4) (+ 1 (/ 2 5)) (<= 10 (+ 10 20)) (+ 1 2))
è¦ããããªã£ãã®ã§ã¯ãªããããï¼
Pythonã¾ãã¯ããã«é¡ããè¨èªä»¥å¤ã§ãLispã»ã©ã¤ã³ãã³ããéè¦ãªè¨èªã¯ç¡ãããããLIsperãLispã³ã¼ããèªã¿ã«ããã¨ãã¯ãã»ã¨ãã©ã®å ´åãã¤ã³ãã³ãããã¦ãªãæã ï¼
ä¸ç½®è¨æ³ã®æ¬å¼§ã¯æ¸ãè¾ãï¼
以ä¸ã®ä¾ãèããããããã¯ãå®éã«æ¸ãã¦ãããããã
((((1 + 2) * ((2 + 3) / (3 - 4))) + (5 / 6))
ããã¯é常ã«æ¸ãè¾ãããªãæ¸ãè¾ãã®ã ãããï¼
ããã¯ã
å¼ãæ¸ãæãæ§ææ¨ã®æ·±ããåãããªããããæåã«ã©ã®ãããæ¬å¼§ãæ¸ãã°ãããåãããªãããã§ããã
ãã®å¼ãæ¸ãæãã©ãã ãã®äººãæåã«(((ãæ¸ããã®ã ãããï¼
ã§ã¯ãåç½®è¨æ³ã¯ã©ãã ãããï¼
(+ (* (/ (+ 2 3) (- 3 4)) (+ 1 2)) (/ 5 6))
ãããæ¸ããããããªããªããæ§ææ¨ã®æ ¹ããæ¸ããããæ§ææ¨ã®æ·±ããåãããªãã¦ããå¼ãæ¸ããããã§ãããæå¾ã«æ¬å¼§ã®å¸³å°»åãããããã°ããã
ã¤ã¾ããLispã¯èªç¶ã¨æ¬å¼§ãæ¸ããããããã«åºæ¥ã¦ããã®ã ã
ã¾ã¨ã
Lispã¯èªã¿ãããã¦æ¸ããããããªããªããããã¯ããåç½®è¨æ³ã¨æ¬å¼§ããæ§ææ¨ãæ ¹ããæ確ã«ããã¾ããèªç¶ã¨æ¬å¼§ãæ¸ããããæ§ã«ãªã£ã¦ããããã§ããã
ä¸ç½®è¨æ³ã¯ãæ§æãææ§ã«ããæ¼ç®åã®åªå é ä½ãå³çµåæ§ãå·¦çµåæ§ãªã©ãèããªããã°ãªãããããèªç¶ã«ãªãã©ããããããè¨èªã¨ãã¦è¤éã«ãªãå¯è½æ§ãç§ãã¦ããã
å°ãªãã¨ãããLispãèªã¿ãããã¦æ¸ãããããã¨è¨ãã®ã¯ããã ã®Lispããã¬ã¤ã§ã¯ãªãããããèªç¶ãªãã¨ãªã®ã ï¼ã<- ã³ã³å¤§äºã
è¿½è¨ : ä¸ç½®è¨æ³ãç³ã¿ããã«è¨ã£ããããã¡ãããä¸ç½®è¨æ³ã®æ¹ãæ°å¦çãªè¨è¿°ã¯èªç¶ã ãã³ã¬ã ãã¯è¨ã£ã¦ããããããããããå®ç¾ããããã«ãè¨èªãããè¤éã«ããã®ã¯ã©ãã ãããï¼
追è¨2: è¨ãããã¨æã£ãããã£ã±ãææãããã®ã§ãè£è¶³ãã¦ããã¨ãSmalltalkã¨ãã®ä¸ç½®è¨æ³ã¯ãæ¼ç®(ã¨ãããå ¨é¨ã¡ãã»ã¼ã¸ãªã®ã§ï¼ã®åªå é ä½ã¯ãªãããã¹ã¦çããã§ãããæ°å¦çãªæ¼ç®ã®é çªã¨ã¯ç°ãªãã®ã§ãããã¦è¨ãã¾ããã§ãããï¼ãã®ãã¨ã«ã¤ãã¦ã¯å¾ã®ããã°ã«æ¸ãæ£ãããã¾ãï¼