Logoåºç¤ææ³æéãã¹ã¿ã¼ :æ¥è§¦ç·¨
æµè¡ã®ã¢ã¬ãLogoã§ãSmalltalk ã¯ãªãã ãä»ã®æ¹ã¨ãã¶ãããã ã£ãã®ã§ãæãä¸ãçã£ã¦ã¿ã¾ããã
æ¥è§¦ç·¨ 㨠çºå編㮠äºé¨æ§æã§ãéããã¾ããæ¥è§¦ç·¨ã¯ãå¤æ
ç·¨ãã¨ããæ¦å¿µç·¨ã§ããä»ã®Lispè¨èªãããç¨åº¦ç¥ã£ã¦ãã人ã¯ãããèªãã° Logo ã®åºç¤ããã¹ã¿ã¼ã㦠Logo å¦çç³»ãæ¸ããã¨ãã§ããããã«ãªãã¾ããã»ã»ãã¶ãã
Logo ã¯ã«ãã³ã®ãªã Lisp
ã¾ãåæç¥èã¨ãã¦ãLogo 㯠Lisp ã§ããããã°ã©ã ã¯ãèª(wordãLispã®ã¢ãã ï¼ãã¨ããªã¹ã(list)ãããæãã¾ãã
Logo 㨠Lisp ã®æ大ã®éãã¯ãã«ãã³ãç¡ããã¨ã§ããä¾ã㰠以ä¸ã® Så¼
(F 'x (G 'y 'z))
㯠Logo ã§ã¯ã
F "x G "y "z
ã¨è¡¨ç¾ãã¾ãã(Logo ã®ã¯ã©ã¼ã㯠ã"ã ã§ãï¼
Lisp風 Så¼ããã«ãã³ãåãé¤ãã«ã¼ã«ã¯ã
- ã¯ã©ã¼ãããã¦ããªãã®ã¯å ¨ã¦é¢æ°ã ï¼ï¼ã¤ã¾ãç´åã§ã«ãã³ãéãã¦ããï¼
- ãã®é¢æ°ãä½åå¼æ°ãåãã®ããããããå¥ã£ã¦ããã°ãéãã«ãã³ã®ä½ç½®ã¯å¤æã§ãã
ã§ãããã®ã«ã¼ã«ã§ãã¨å¯å¤é·å¼æ°ã®é¢æ°ãåé¡ã«ãªãããã§ããããã®ç¹ã«ã¤ãã¦ã¯å¾è¿°ãã¾ãã
èªã®è©ä¾¡
Lisp ã ã¨ã¯ã©ã¼ããã¦ããªããã°å³è©ä¾¡ã§ããããLogoã§ã¯ èªã®è©ä¾¡ã« thing æç¶ããæ示çã«è¨è¼ãã¾ãã
ä¾ãã°ä»¥ä¸ã® Så¼
(F x (G y z))
ã¯ã
F thing "x G thing "y thing "z
ã«ãªãã¾ãããã ãããã§ã¯ãããã«thing, thing! ã¨é¬±é¶ããã®ã§(ã¢ã³ãã¼ãã¤ã½ã³ã® SPAM ã®ã³ã³ãã®ããã§ãï¼ã
F :x G :y :z
ã®ããã« ãthing "xããã:xãã¨æ¸ããã¨ãåºæ¥ã¾ã(ããããããã表ç¾ãã¨ããã¾ã)ã
æé»ã®ã¯ã©ã¼ã
èªã æ°å¤èªã®å ´åã¯ä¾å¤ã¨ãã¦ãæé»çã«ã¯ã©ã¼ãããã¾ããã¤ã¾ãã
sum "1 "2
ã¨
sum 1 2
ã¯ãåãæå³ã«ãªãã¾ãã
ãªã¹ã
Logo ã Lisp ã®ä¸ç¨®ãªã®ã§ããªã¹ã(list) ãæã¡ã¾ããã¨ããããLogo ã® ãªãã¸ã§ã¯ãã¯ èª ã¾ã㯠ãªã¹ã ã®ã©ã¡ããã§ãã
丸æ¬å¼§ã()ãã§ã¯ãªãè§æ¬å¼§ã[]ãã使ãã¨ããäºç´°ãªéããããã¾ãããã»ã¼åãã¢ãã§ããä¾ãã°ã
('x 'y 'z)
ã¯ãLogo ã§ã¯
["x "y "z]
ã«ãªãã¾ãã
ãªã¹ãã®è©ä¾¡ã¯ run æç¶ãã§æ示çã«è¡ãã¾ãï¼thing ã® ãªã¹ãçã§ãï¼ã
(sum 1 (sum 2 3)
ã¯ã
sum "1 run [sum "2 "3]
ã«ãªãã¾ãã
ãªã¹ãæä½ã«ã¤ãã¦ãLisp ã® car 㨠cdr ã¯ããããã first 㨠butfirst ã«ãcons 㯠fputãlist 㯠list ã®ã¾ã¾ãappend 㯠sentence ã«ãªãã¾ãã
>>first [1 2 3] 1 >>butfirst [1 2 3] [2 3] >>fput [1 2] [3 4] [[1 2] 3 4] >>list [1 2] [3 4] [[1 2] [3 4]] >>sentence [1 2] [3 4] [1 2 3 4]
ã¡ãã£ã¨è©±é¡ã¨ãããããã©ãã¤ãã§ã«ãèªã®åæ㯠wordã§ãã
>>word "mine "koa "minekoa
ãªããlist çã¯äºé ãªãã¬ã¼ã·ã§ã³ã§ãããã°ã«ã¼ãã³ã°ã«ãã³ï¼å¾è¿°ï¼ã§å¯å¤é·ã«ãªãã¾ãã
>>word "mine "ko "a "mineko >>(word "mine "ko "a) "minekoa
ä¸ç½®ãªãã¬ã¼ã·ã§ã³ï¼ä¸ç½®æ¼ç®åï¼ã¨ã°ã«ã¼ãã³ã°ã«ãã³
Logo ã®ãã£ã¨ã Lisp ããããã¬ã¨ããã ä¸å¤äºé ãªãã¬ã¼ã·ã§ã³ ãæã¤ã¨ããã§ãã極ã æ®éã®ããã°ã©ãã³ã°è¨èªã®ããã«
>>1 + 2 * 3 7
ã¨ãæ¸ãã¾ãï¼ããã¦æå¾ éãã«åãã¾ãï¼ãä¸ç½®ãªãã¬ã¼ã·ã§ã³ã«ã¯ãæ°å¤æ¼ç®ã¨è«çæ¼ç®ãããã¾ããå ·ä½çã«ã¯ ã+ããã-ããã/ããã*ããã=ããã<ããã>ãã§ãã*2
æ¼ç®åã®åªå é ä½ãå¤ãããã¨ãã«ã¯ã
>>(1 + 2) * 3 9
ã¨ã丸æ¬å¼§ã使ã£ã¦ã°ã«ã¼ãã³ã°ã§ãã¾ããã¾ãããã®ã°ã«ã¼ãã³ã°ã«ãã³ã¯ãåè¿°ããã¨ãããå¯å¤é·å¼æ°ã®ã°ã«ã¼ãã³ã°ã«ã使ãã¾ãã
>>(sum 1 2 3 4) 10
æç¶ãã®å®ç¾©
æå¾ã«ãLogo ã® Lispã£ã½ãã¨ããã¨ãããããªãã¨ãããæ¯ã¹ã¦æ¥è§¦ç·¨ããçµãã«ãã¾ãã
Logo ã§ã¯ ããããããã·ã¼ã¸ã£ã®ãã¨ããã³ãã³ã(command)ãï¼æ»ãå¤ãç¡ãï¼ããã¡ã³ã¯ã·ã§ã³ã®ãã¨ãããªãã¬ã¼ã·ã§ã³(operation)ãï¼æ»ãå¤ãããï¼ã¨è¨ãã¾ããããããç·ç§°ãã¦ãæç¶ããã¨è¨ãã¾ãã
æç¶ãã®å®ç¾©ã¯ãdefineæç¶ã
define "é¢æ°å [ [ä»®å¼æ°ãªã¹ã] æ¬ä½]
ã§è¡ãã¾ãã以ä¸ã«ä¾ã示ãã¾ãã
define "opeFoo [[arg1 arg2] [make "hoge sum thing "arg1 256] [output prduct thing "hoge arg2]]
ã¨ã£ã¦ã Lisp風 ã§ããã
ãã ã Logoã§ã¯ å®ã¯ããã¾ããããªé¢¨ã«ã¯æ¸ãã¾ãããLogo ã«ã¯ããã£ã¨ã«ã¸ã¥ã¢ã«ãªè¡¨ç¾ toãend ããããæ®éã¯ãã¡ãã使ãã¾ããããã使ãã¨åæ§ã®ã¢ãã以ä¸ã®ããã«æ¸ãã¾ã
to opeFoo :arg1 :arg2 make "hoge :arg1 + 256 output :hoge * :arg2 end
ã¨ããããã§ãLogo ã¨ã¯ Lisp ããã¼ã¹ã«ãææ³ã®è¦ãç®ã Lispã£ã½ãç¡ããããã®ãã¨ç解ããã°ã飲ã¿å±ããã§ã®èèã«å°ãã¾ããã
ã¾ã¨ã
Logo ã®ææ³ã¯ã
LOGOããã°ã©ã : { ã³ãã³ã }* ã³ãã³ã : æç¶ãå + { å ¥å }* å ¥å : "èª | ãªã¹ã | ãªãã¬ã¼ã·ã§ã³ ãªãã¬ã¼ã·ã§ã³ : æç¶ãå + { å ¥å }* èª : { è±æ°å | ç¹æ®è¨å· }* ãªã¹ã : { { èª | ãªã¹ã }* }
ãããåºæ¬ã«ãããã表ç¾ãæ°å¤èªã®æé»ã¯ã©ã¼ããä¸ç½®ãªãã¬ã¼ã·ã§ã³ãtoãend ãå ããã¢ãã
æ¬ã¨ã³ããªã¼ã®è¨è¿°ã¯ å·é æ´ ããã® ãLOGOè¨èªå ¥éããåèã«ãã¾ããã
LOGOå ¥é (é»åè¨ç®æ©ã®ããã°ã©ãã³ã°)
- ä½è : å·éæ´
- åºç社/ã¡ã¼ã«ã¼: å¹é¢¨é¤¨
- çºå£²æ¥: 1987/03
- ã¡ãã£ã¢: åè¡æ¬
- è³¼å ¥: 1人 ã¯ãªãã¯: 20å
- ãã®ååãå«ãããã° (1件) ãè¦ã