åã³ã¼ãã£ã³ã°ã¯Common Lispã§ããã
ãã¦ãGPSã¨ãããã®ãããã¾ããå°çã測ä½ãããã¤ã§ã¯ãªããGeneral Problem Solverã§ããGeneralã¨ãã夢ã®ãããªååãä»ãã¦ãã¾ããããã®GPSã¯ä»»æã®å½¢å¼åãããè¨å·åé¡ã解ããã¨ãã§ãããããã®ã§éãã§ã¿ã¾ããã
ã¡ãªã¿ã«GPSã®Common Lispå®è£ ã¯PAIPã¨ããæ¬ã«è¼ã£ã¦ãã¾ããæ¥æ¬ã§ã¯ãå®ç¨ Common Lispãã¨ããé¡ã§è²©å£²ããã¦ãã¾ãã
- ä½è :ãã¼ã¿ã¼ã»ãã¼ã´ã£ã°
- åºç社/ã¡ã¼ã«ã¼: ç¿æ³³ç¤¾
- çºå£²æ¥: 2015/06/02
- ã¡ãã£ã¢: Kindleç
幸ãã«ãPAIPæ¬ã®ä¸èº«ã¯MITã©ã¤ã»ã³ã¹ã§å ¬éããã¦ãã(太ã£è ¹ï¼ï¼)ã®ã§ããããè¦ã¦ã³ã¼ãã移æ¤ããã
ãªãã§ãããªãã¨ãã¦ãããã¨ããã¨ãã¡ããã©å æ¥Factorioã®çç£é¢é£ã®ãã¼ã¿ãä½æããã®ã§ããã®ãã¼ã¿ãé£ããã¦å·¥å ´ã®ãã©ã³ãã³ã°ã¨ããã§ããªããã¨è©¦ãã¦ã¿ããã®ã ã ããããå·¥å ´ã®ãã©ã³ãã³ã°ã¯è¨å·åé¡ãªã®ãï¼ã¨ããæããããããã¾ã試ãã«éãã§ã¿ããã
ãããã©ãã
ã§ãã£ã¦ä»åãã¡ãã£ã¨ãããããã«ééããã®ã§ãã¡ã¢ãã¦ãããã ãããpackageã¾ããã®æåã«ãããã®ã§ããã
package-inferred-system
ã«ãããããã±ã¼ã¸å士ã®ä¾åé¢ä¿ - ããã¯ãã®ã·ã³ãã«ãç¡ã
ä»åã¯ã¢ã¸ã¥ã¼ã«ã·ã¹ãã ã«package-inferred-system
ãæ¡ç¨ãããããã«ã¤ãã¦ã¯ä»¥ä¸è¨äºã§èª¬æãã¦ããã®ã§åç
§ãã¦ã»ããã
ãã¦ãpackage-inferred-system
ã§ã¯ãããã±ã¼ã¸å士ã®ä¾åé¢ä¿ãèªåèªèãã¦ã¢ã¸ã¥ã¼ã«ã解決ãã¦ãããã
ä¾ãã°foobar
ã¨ããpackage-inferred-systemã§foobar/a
ã¨ããããã±ã¼ã¸ãfoobar/b
ã¨ããããã±ã¼ã¸ãuse
ãã¦ããå ´åããããä¾åé¢ä¿ã¨æããããfoobar/b
ãfoobar/a
ã«å
ç«ã£ã¦ã³ã³ãã¤ã«ãããããã«ãªãã
;; a.lisp (in-pacakge :cl-user) (defpackage :foobar/a (:use :cl :foobar/b)) (in-package :foobar/a) (func) ; => "func"
;; b.lisp (in-pacakge :cl-user) (defpackage :foobar/b (:use :cl) (:export :func)) (in-package :foobar/b) (defun func () "func")
ãã¦ãå¤é¨ã®ããã±ã¼ã¸ã®ã·ã³ãã«ãå¼ã¶å ´åã«ã¯use
ãã以å¤ã«ãã
以ä¸ã®ä¾ã®ããã«foobar/b:func
ã¨ãã¦å¼ã¶ãã¨ãã§ããããããã¦ããã±ã¼ã¸åãæã«æå®ãããã¨ãããã±ã¼ã¸åã修飾ããããªã©ã¨ããã
;; a.lisp - package-inferred-systemã§ã¯åä½ããªã (in-pacakge :cl-user) (defpackage :foobar/a (:use :cl)) (in-package :foobar/a) ;; ããã±ã¼ã¸åã修飾ãã¦å¼ã³åºãã¦ãã (foobar/b:func) ; => "func"
package-inferred-system
ã¯ããã±ã¼ã¸ã®use
é¢ä¿ãä¾åé¢ä¿è§£æ±ºã«ä½¿ã£ã¦ãã
ããããªãããpackage-inferred-system
ã使ãå ´åã¯åæãç°ãªã£ã¦ããã
use
ãè¡ããã«ããã±ã¼ã¸åã修飾ãããã¨ã§ã·ã³ãã«ãåç
§ãããã¨ããå ´åããã®ã·ã³ãã«ã¯å¼ã¹ãªããã¨ãããå¼ã³åºãã«å¤±æããã®ã§ããã
ãªããªããã·ã³ãã«ãå¼ã³åºããã¨ãã¦ããã·ã³ãã«(ã¨ãã·ã³ãã«ãããã¯ãã®ããã±ã¼ã¸)ãåå¨ããªãããã§ããã
ã©ããããã¨ï¼ããã¡ãã£ã¨æ·±ãèãã¦ã¿ããã
ã¾ããã©ããã®ããã±ã¼ã¸ã«ããã·ã³ãã«ãå¼ã³åºãããã«ã¯ãã·ã³ãã«ã¨ãããå ¥ããããã±ã¼ã¸ãå ã«åå¨ãã¦ããªããã°ãªããªããããã¯å½ç¶ã®æè¦ã ã
ã·ã³ãã«ãåå¨ããã¨ã¯ã©ããããã¨ãã¨ããã¨ãå ã«å®ç¾©ããã¦ãããã¨ãããã¨ã ã ç¹ã«Common LispãASDFã®ãããªãã«ããã¼ã«ã§ã³ã³ãã¤ã«ãã¤ã¤ä½¿ããããªå ´åã¯ãASDFã«ãã£ã¦è©²å½ã®ã½ã¼ã¹ãã¡ã¤ã«ãã³ã³ãã¤ã«ããããã¨ã§ãäºåã«ã·ã³ãã«ãå®ç¾©ããã¦ããªããã°ãªããªããã¨ãããã¨ã§ããã
ã¡ãªã¿ã«ãCommon Lispä¸ã§ã®ããã°ã©ã ã®è«ççãªæ§æåä½ã¯ããã±ã¼ã¸ã ãããã«ããã¼ã«ã§ããASDFä¸ã§ã®ããã°ã©ã ã®æ§æåä½ã¯ãã½ã¼ã¹ãã¡ã¤ã«ã§ãã(ç°¡ç¥åãã¦ãã)ã ã½ã¼ã¹ãã¡ã¤ã«ã¨ããã±ã¼ã¸ã¨ã®é¢ä¿ã¯ç¬ç«ãã¦ãããå¿ ããã1対1ã§å¯¾å¿ãã¦ããããã§ã¯ãªãã
ããã«è¦ç´ãå ããã®ãpackage-inferred-system
ã§ãããASDFãpackage-inferred-system
ãæå¹ãªã·ã¹ãã ãã³ã³ãã¤ã«ããã¨ããããã±ã¼ã¸åããã®ã¾ã¾ã½ã¼ã¹ãã¡ã¤ã«åã«å¯¾å¿ãã¦ããã¨ã¿ãªãã
ã½ã¼ã¹ãã¡ã¤ã«ã®ã³ã³ãã¤ã«é åºããããã±ã¼ã¸ã®use
é¢ä¿ããã¨ã«æ±ºå®ããããã«ãªãã
ãã®ãããç´æ¥use
ãã¦ããªãããã±ã¼ã¸ã®ãããã¡ã¤ã«ã¯æ±ºãã¦ã³ã³ãã¤ã«ãããªãã¨ããæåãçºçãããããã¨ã·ã³ãã«ãå®ç¾©ãããªãã®ã§ãå¼ã¼ãã¨ããã¨å¤±æãã¦ãã¾ããã¨ããç¾è±¡ãç¾ããã®ã ã
use
ã使ããªãå ´åã«ã¯ã空ã®import-from
ãã¤ãããã¨ã§ASDFã«ä¾åé¢ä¿ãèªèããããã¨ãããã¯ããã¯ã使ããããããç¡ãã¨ä¾åé¢ä¿ãåæããã¦ãã¾ããæ£ããåä½ã§ããªãã
;; a.lisp (in-pacakge :cl-user) (defpackage :foobar/a (:use :cl) (:import-from :foobar/b)) (in-package :foobar/a) ;; ããã±ã¼ã¸åã修飾ãã¦å¼ã³åºãã¦ãã (foobar/b:func) ; => "func"
ããã±ã¼ã¸ã移åããã®ãå¿ãã
ããã±ã¼ã¸ãä½æããã«ã¯defpackage
ã使ãããé常ã«ããå¿ããã¡ãªã®ãã(in-package :cl-user)
ã¨(in-package :å®ç¾©ããããã±ã¼ã¸)
ã§ããã
(in-package :cl-user) ;; ãããå¿ããã¡ï¼ï¼ (defpackage :foobar (:use :cl)) (in-package :foobar) ;; ãããå¿ããã¡ï¼ï¼
åè
ã¯ãã«ã¬ã³ãããã±ã¼ã¸ã:cl-user
ã«åãããã®ã§ãå¾è
ã¯ã«ã¬ã³ãããã±ã¼ã¸ãä½æããããã±ã¼ã¸ã«ç§»åããããã®ã ã
ã©ããã¦ãã®ãããªãã¨ãå¿ è¦ãªã®ã ããï¼
ãã®çãã¯ãCommon Lispã¯ãã¨ãã¨ã¤ã³ã¿ã©ã¯ãã£ããªè¨èªã§ãããã¨ãããã¨ãè¸ã¾ããã¨åãããããããã®æCommon Lispã¯ãç¾å¨ã®ã¹ã¯ãªããã£ã³ã°è¨èªã®ããã«ãç´æ¥ããã°ã©ã ãæã¡è¾¼ãã§å¯¾è©±çã«åä½ããã¦ããã LISPã¯å¤ãæ代ããããã®ã§ã大ããª1ã¤ã®ãã¡ã¤ã«ã«è¤æ°ã®ããã±ã¼ã¸ãè¨è¿°ãããã¨ããã¹ã¿ã¤ã«ãå¤ãã£ããããããªãããããªä¸Common Lispã§ãã½ã¼ã¹ã³ã¼ããåå²ããã®ãä¸è¬çã«ãªãããããè£å©ããç®çã§ãã«ããã¼ã«ãåºç¾ããã
Common Lispã¨åãããã«åä¸ãã¡ã¤ã«å ã«è¤æ°ã®ããã±ã¼ã¸ãç¨æã§ããPerlã¨ã®éã«ããå·®ç°ã¯ãããã±ã¼ã¸å®£è¨ãè¡ã£ã¦ãèªåçã«ã«ã¬ã³ãããã±ã¼ã¸ã移åããããã§ã¯ãªããã¨ããç¹ã§ããã Common Lispã¯ã¤ã³ã¿ã©ã¯ãã£ããªè¨èªãªã®ã§ãREPLãåæã¨ãã¦è¨è¨ããã¦ãããREPLãéãã¦èªç±ã«ã«ã¬ã³ãããã±ã¼ã¸ã移åã§ããããã«ãããããããã±ã¼ã¸å®£è¨ã¨ããã±ã¼ã¸ç§»åã¨ãåºå¥ãã¦ããã®ãããããªãã
package prefixãå¿ãã
package-inferred-system
ã§ã¯ãã·ã¹ãã åãããã±ã¼ã¸ã®é ã«ä»ããªããã°ãªããªãããããå¿ããã¨å½ç¶å¼ã³åºããªãã®ã§ãå¿ããªãããã«ããã