Lispã¯ããã
å æ¥ãç¾å¨é¢ãã£ã¦ããããã¸ã§ã¯ãã®ãã£ããã§ãã¡ã³ãã¼ã®ä¸äººã
Lispãè¯ãã¨èããã®ã§èå³ãã
ã¨ã¤ã¶ããã¦ããã®ã§ã
Lispè¯ãã§ããã¼ãEmacsã使ã£ã¦ããã®ã§ä»ã§ãç¾å½¹ã§ãã
ã¨è¿ãã¦ããã¾ãã
ãã身è¿ãªã¨ããã«ãæå¤ã¨ãããã
ã¨ã®è¿çã§ããããç¾ä»£ã®ä¸ã®ä¸ã«Lispãå¦ã¶æå³ã¯ããã®ã ãããã¨ãèãã¾ããã
Lispã¨ã®åºä¼ã
ç§ãLispã¨ã§ãã£ãã®ã¯ã1990å¹´ãæ°åã§å ¥ç¤¾ããä¼ç¤¾ã®æåã®ããã¸ã§ã¯ãã§ããã ãã®ããã¸ã§ã¯ãã¯æé»æ©ã¡ã¼ã«ã¼ãæ¿åºã®ç 究æ©é¢ããå§è¨ããããã®ã§ãæã足ããªãã®ã§å½æã®ä¼ç¤¾ã«åå§è¨ã¨ããããã¡ã§å注ãããã®ã§ããã
ãã¼ãã¯ãLispã®ãªãã¸ã§ã¯ãæåæ¡å¼µãæ¤è¨ãããã¨ãããã®ã§ãããå½æã1990å¹´ã¨ããå¹´ã¯ã¾ã ããã«çµæ¸ãã¯ãããåã§ãæ¯è¼çç´æã«ãä½è£ããããããã»ã©ãã£ã¡ãããææç©ã®å®ç¾©ããªãã£ãããã«è¨æ¶ãã¦ãã¾ããã¬ãã¼ã+æ¤è¨¼ç¨ã½ã¼ã¹ã³ã¼ãä¸å¼ã¨è¨ã£ããã®ãç´åããè¨æ¶ãããã¾ãã
å½æã®Lispã®å é²æ§ã説æããã«ã¯ã1990å¹´ååã®ITæ¥çã®ç¶æ³ãç°¡åã«èª¬æãã¦ããå¿ è¦ãããã¾ãã ã¾ãå®åã«ä½¿ããã主è¦ãªããã°ã©ãã³ã°è¨èªã¯ - COBOL - FORTRAN ã主æµã§ãCè¨èªã¯PCï¼Windowsã¯ã¾ã æ®åãã¦ããããMS-DOSãã¡ã¤ã³)ã¢ããªç¨ã®ããã°ã©ãã³ã°è¨èªã¨ãã¦ä½¿ããå§ãããããã§ãã¾ã ããã¼ã»å¦è¡çãªç¨éãå¤ãã£ãããã«æãã¾ã*1ã
ã¾ãã大å¦ãªã©ã§ããã°ã©ãã³ã°æè²ã§ç¨ããããã®ã¯BASICãPASCALãä¸è¬çã§ãããç§ã¯å¤§å¦ã®ææ¥ã§PASCALãå¦ã³ãçµ±è¨å¦ãå¿çå¦ã®å®é¨ã¬ãã¼ãä½æã®ãããPASCALï¼Turbo PASCALã¨ããIDEãããã¯ããããã¾ããï¼ã§ããã°ã©ã ãæ¸ããããã¦ãã¾ããã
C++ã«ã¤ãã¦ã¯ããã¤ã¯ãã½ãã社ãåã®C++å¦çç³»ãVisual C++ 1.0ãããªãªã¼ã¹ããã®ã1993å¹´ã§ã1990å¹´å½æã¯ãªãã¸ã§ã¯ãæåã¨ããèãæ¹ã話é¡ã«ã¯ãªã£ã¦ãããã®ã®ãã¾ã ãªãã¸ã§ã¯ãæåãå®è£ ããè¨èªã¯ä¸è¬ã«ã¯æ®åãã¦ãã¾ããã§ããã
Objective-Cã«ã¤ãã¦ã¯ã¹ãã£ã¼ãã»ã¸ã§ããºãAppleãé社ãã¦ä½ã£ãNeXT社ã®ãããã¯ãã1988å¹´ã«çºå£²ããããNext Cubeã以éã®ç°å¢ã§ã¯ä½¿ãã¾ããã ãªãã¸ã§ã¯ãæåã«ã¤ãã¦ã¯Nextã®ç°å¢ãå é ãèµ°ã£ã¦ããç¶æ³ã§ããããå人ãæãåºãããã®ã§ã¯ããã¾ããã§ããã
ã¡ãªã¿ã«Javaè¨èªãããã¥ã¼ããã®ã¯ãβçã1995å¹´ãæ£å¼ãªãªã¼ã¹ã1996å¹´ã§ããä»ã«ãã¦æãã°ã1990年代ååã¨ããã®ã¯ã¤ã³ã¿ã¼ãããã®æ®åãªã©ã§ããã°ã©ãã³ã°ç°å¢ãä¸æ°ã«å¤æ§åããç´åã®æ代ã ã£ãã¨è¨ããããããã¾ããã
ãããªç¶æ³ãªã®ã§ãSmalltalkãObjective-Cã®ææ³ãæç®ãªã©ã§åç §ãã¦ãCommonLispã®å¦çç³»ã®ä¸ã¤ã§ãããKyoto Common Lispï¼KCL)ã¨ããå½ç£ã®ãªã¼ãã³ã½ã¼ã¹ã®CommonLispã®å¦çç³»ãæã«å ¥ããCommonLispã®æ©è½ã«ãµãã¾ãããã¯ãã¨ã¯ãã¼ã¸ã£ãã¤ãã£ã¦ãªãã¸ã§ã¯ãæåã®ç¹å¾´ã®ä¸ã¤ã§ããã«ãã»ã«åãå®ç¾ãã¾ããã
ç¶æ¿ã«ã¤ãã¦ãã¡ã¿ããã°ã©ãã³ã°çãªæ©è½ãç¨ãã¦å®ç¾ãã¾ããããã¾ã§ããã¨MixInã«è¿ããã®ã ã£ããããªæ°ããã¾ãã
ãã®ããã¸ã§ã¯ããé²ããã«ããããã¾ãã¯Lispãã®ãã®ãå¦ã¶å¿ è¦ãããããã§ãçè ã¯KCLã®ä½è ã®ãããç´ã ã«è¨ããä¸è¨ã®æ¬ã§åå¼·ãã¾ããã
èªã¿é²ãã«ã¤ããä¸è¨ã®æ¢åã®è¨èªã«ã¯ãªãæ°ããæ¦å¿µãã©ãã©ãåºã¦ãã¦åºæ¿çã§ã¯ãã£ããã®ã®é£æ¸ãã¾ããã
主ãªãã®ãæããã¨ã - ãªã¹ãæ§é - å帰 - ä¾å¤ï¼éå±æçè±åºï¼ - ã¬ãã·ã«ã«ã¹ã³ã¼ãï¼ã¯ãã¼ã¸ã£ï¼ - é«éé¢æ° - ç¡åï¼Î»ï¼é¢æ° çã ã
ä»ã§ã¯å²ã¨ä¸è¬çãªæ¦å¿µãå¤ãã¨æãã¾ãããç¹°ãè¿ãããã§ããå½æã®ä¸»æµè¨èªã«ã¯å ¨ããªãã£ããã®ã°ããã§ã*2ã
ãããã®æ¦å¿µã¯ãã®å¾æ®åãå§ããè¨èªã«æ®µéçã«åãå ¥ãããã¦ããã¾ããã
ããããããã¨æãã¾ãããçè ã¯Lispãå¦ãã ãã¨ã§ãããããå é²çãªæ¦å¿µãä½å¾ãããã¨ãã§ãããã®å¾ã®ã¨ã³ã¸ãã¢ã®ãã£ãªã¢ã«ã¨ã¦ãå½¹ã ã£ãã®ã§ãã
å é²çãªè¨èªãå¦ã¶ã¨ãããã¨
å½æã¯Lispãå¦ã¶ãã¨ã§ãããããå é²çãªæ¦å¿µãã¾ã¨ãã¦å¦ã¶ãã¨ãã§ããã®ã§ããæå³å¹ççã§ãã£ãã¨è¨ãã¾ãã
ç¾ä»£ã«ããã¦Lispãå¦ã¶ãã¨ã¯å½æã®ãããªå§åçã¢ããã³ãã¼ã¸ã¯ãªãããããã¾ããã
ãã ãç¾å¨ãè¨ç®æ©ç§å¦ã®æ¥ç¸¾ãç¥è¦ãå®è£ ããå é²çãªè¨èªãããæ°å¹´å¾ãåæ°å¹´å¾ã«ããããæ°ããæ¦å¿µãå®ç¨çãªè¨èªã«å°å ¥ãããã¨ããæµãã¯ç¶ãã¦ãã¾ãã
ãã¨ãã°ãSwiftã«ã¯é¢æ°åè¨èªããå°å ¥ãããæ¦å¿µãããã¾ãã
Swift Monads, Functors and Applicatives with examples | Medium
Monad, Functor and Applicatives in Swift | by Steven Curtis | Medium
ç´æ¥å°±è·ãä»äºã«ç¹ãããªãã¦ããå é²çãªè¨èªãå¦ã¶æå³ã¯ãããããã¨ã§ã¯ãªããã¨æãã¾ãã
ã¡ãªã¿ã«æè¿ã¯å¦è¡è²ã»å®é¨æ§ã®å¼·ãè¨èªããå®ç¨çãªè¨èªã¸ã®æ¦å¿µãå°å ¥ããããã¨ãããã便å®çã«åç´çã¨å¼ã¶ã¨ããã¨ããã¨ãã°ReactiveXã®èãæ¹ããC#ã®ãªãªã¸ãã«ããJSãSwiftãªã©ä»ã®è¨èªã«ä¼æããããã«ãå®ç¨çãªè¨èªã®éã§ããããæ°ããèãæ¹ãç¸äºã«æ®åãã¦ããã±ã¼ã¹ãããã°æ°´å¹³çãªå±éãå¢ãã¦ããããã«æãã¾ããç¾ä»£ã§ã¯ä»åéã®è¨èªã®ãã©ãã¤ã ã«ç®é ããã¦ãããã¨ãéè¦ãªã£ã¦ãã¦ãã¾ããã
Lispã®è¯ãã¨ãã
ã§ã¯ç¾ä»£ã«ããã¦Lispãå¦ã¶ä¾¡å¤ã¯ãªãã®ã§ããããï¼ãããªãã¨ã¯ããã¾ããã
ææ³ãã·ã³ãã«
Lispã¯ãã¹ã¦ãã«ãã³ï¼ï¼ã§å²ã¾ãã¦ããã®ã§åè¦ã¯ã¨ã£ã¤ãã«ããã§ãããææ³ã¨å¼ã¹ãã»ã©ã®ãã®ãããã¾ãããã¡ãã£ã¨ä½è¨ã£ã¦ãããããããªãããããã¾ããããä¹±æ´ãªè¨ãæ¹ãããã¨ãAST*3ããã®ã¾ã¾æ¸ãã°ããã°ã©ã ã¨ãã¦æç«ããã®ã§ãã
ãã¨ãã°ãæ¼ç®åã®åªå é ä½ãè¦ããå¿ è¦ã¯ããã¾ããã
é常ã®è¨èªã§ã¯ã1ã¨2ã足ãããã®ã3åããå¦çãæ¸ããã¨ããã¤ãããã
1 + 2 * 3
ã¨æ¸ãã¦ãã¾ããæå³ããçµæã¨ç°ãªãåãããã¦ãã¾ãã¨ãã¨ãããã¾ããã¾ãå æ¸ä¹é¤ã®åªå é ä½ãééãã人ã¯å°ãªãã¨æãã¾ãããè¨èªç¹æã®æ¼ç®åã¨ãã ã¨çµæ§ééãããã¨ãæãã¨æãã¾ãã
Lispã§ã¯ä¸çªå å´ã®ã«ãã³ã®ä¸ããè©ä¾¡ããã®ã§ã
(* (+ 1 2) 3)
ã¨ãªãä¸ç®çç¶ã§ãã
ææ³ãã·ã³ãã«ã§ãããã¨ã¯å¦çç³»ã®å®è£ ã容æã§ãããã¨ã§ãããã¾ããããã°ã©ãã³ã°è¨èªãä½ãä¸ã§æ«æããã¡ãªãã¼ãµï¼yaccãçæããé¨åã«ç¸å½ï¼ãæ¸ãå¿ è¦ããªãã®ã§ãLispã®ãµãã»ãããæ¸ããã¨ã¯ä»ã®è¨èªã«æ¯ã¹ã¦ã¯ããã«ç¨æã§ãã
åèãããã
Lispã¯é·å¹´ãã³ã³ãã¥ã¼ã¿ç§å¦ã®ç 究ã«ãããPoCã»ãããã¿ã¤ãã³ã°ã«ç¨ãããã¦ããããããã³ã³ãã¥ã¼ã¿ç§å¦ã®å ¥éæ¸ã«ã¯Lispãç¨ãã¦èª¬æãããæ¬ãå°ãªãããã¾ãããæã代表çãªãã®ã¨ãã¦ã¯SICPã®ç¥ç§°ã§ãç¥ããããã®æ¬ã§ãã
ã»ãã«ããããªã¤ã©ã¼ã®è´ãç©ãã§æåãªæ°å¦æ¬ã®èè ãåç°æ¦ããããããããç´ æ°å¤æ²ããªã©ãã大èã§ã¯ããã¾ããé¢ç½ãæ¬ã§ãã
ãã¾ã
ä»ã»ã©ååãã¯ãªãã£ããã©ããã®æ¬ããä¸è©±ã«ãªãã¾ãã
*1:ã²ã¼ã æ¥çã§ã¯ãã«ã¢ã»ã³ãã©ãæ®éã§ããããã¥ã¤Cè¨èªãæ¡ç¨ããã¦ãã£ãã¨èãããã¨ãããã¾ã
*2:éå±æçè±åºã«ã¤ãã¦ã¯ãCè¨èªã®ã©ã¤ãã©ãªé¢æ°ã§setjmp/longjmpã¨ãããã®ãããã«ã¯ããã¾ãããã¾ããå帰ã¯Cè¨èªã使ãã¾ã
*3:Abstract Syntax Tree: ja.wikipedia.org