- tags: ðããã°ã©ãã³ã°ãã©ãã€ã
- links
SICPãšã¯
Structure and Interpretation of Computer Programsã®ç¥.
ãã®æ¬ãèªãã§ãªã人ã¯ã¢ã°ãªã ãšãããããããª, èšç®æ©ç§åŠã«ãããå€å žçæç§æž.
SICPã¯ãããŽãŒãšèªã.
SICP Literature Notes
Chapter 1::Building Abstractions with Procedures
æç¶ãã«ããæœè±¡
-
è€æ°ã®åçŽãªèããåæã㊠1 ã€ã«ãã.
-
2 ã€ã®èããåæã«èŠããããã« 1 ã€ã®ãã®ã§ç¹ã. ãã®å®åšã«ãããŠãããã«ä»éããŠããã»ãã®èãããããããåé¢ãã
procedures data primitive element +, *, <, = 23, 1.738 means of combination () combination if cond means of abstraction defun èšèªã¯ä»¥äžã®ä»æããæããŠãã.
Level0: åºæ¬åŒ (ããªããã£ããªæç¶ãã®æ§ç¯)
ãã£ãšãåºæ¬çãªæç¶ã.
- which represent the simplest entities the language is concerned with,
- èšèªãé¢ãããã£ãšãåçŽãªãã®ãè¡šã.
primitive expressions åºæ¬åŒ:
- which represent the simplest entities the language is concerned with,
- èšèªãé¢ãããã£ãšãåçŽãªãã®ãè¡šã.
1, +, -
Level1: çµåãæ³ (çµã¿åããæç¶ãã«ããæœè±¡ã®æ§ç¯)
è€æ°ã®æç¶ããçµã¿åãããŠäžã€ã«ããæç¶ã.
- by which compound elements are built from simpler ones.
- ããåçŽãªãã®ããåæç©ãã€ãã.
Emacs Lisp ã§ã¯ çµåã (combination) 㯠()
ã§è¡šçŸãã.
(* 1 1)
Level2: æœè±¡åæ³ (ååã€ãå€ã«ããæœè±¡ã®æ§ç¯)
ãªããžã§ã¯ããå€ (value) ãšããå€æ° (variable) ãèå¥ãããã®ãåå. ååãã€ããããšã§, å€ãèå¥ãã.
Emacs Lisp ã§ã¯ ååã€ã㯠defun
ã§è¡šçŸãã.
(defun size () 2)
(size)
Level3: æç¶ãå®çŸ© (ååã€ãæç¶ãã«ããæœè±¡ã®æ§ç¯)
ååä»ãã¯, å€ã ãã§ãªããŠæç¶ãã«ãã§ãã.
- by which compound elements can be named and manipulated as units.
- åæç©ã«åãã€ã, åäžã®ããšããŠæ±ã.
ååã®ã€ããããæç¶ã. ãããããããé¢æ°ãšåŒã¶.
(defun square (x) (* x x))
æç¶ãå®çŸ©ã¯, 现éšããããããšãã§ãã. ãããã æç¶ãæœè±¡ ãšãã.
Level4: é«éæç¶ãã«ããæœè±¡ã®æ§ç¯
æç¶ãããã€ããæç¶ããé«éæç¶ããšãã
- æç¶ããåŒæ°ã«ãšã
- æç¶ããæ»ãå€ãšããŠè¿ã
(square (square (square 2)))
Level5: lambda (ååãªãæç¶ã ã«ããæœè±¡ã®æ§ç¯)
é«éæç¶ãã®åŒæ°ã«ãã¡ãã¡, defun ã§å®çŸ©ãããæç¶ãããããã®ã¯ç ©ããã.
ååãªãã®æç¶ããæ±ããã. ããã»ã¹ãçã¿åºãç¹æ®åœ¢åŒã lambda ãšãã.
Emacs Lisp ã§ã¯ lambda
ã§è¡šçŸãã.
ååã€ãæç¶ãã¯, 以äžã®ç³è¡£æ§æãšãªã£ãŠãã. Lisp ã€ã³ã¿ããªã¿ã¯å®éã«ã¯ä»¥äžã®ããã«è§£éããŠãã.
(defun square
(lambda (x) (* x x))
ããããã¯ããã°ã©ããšããŠ, ããã°ã©ã ã®æ ¹åºã«ããæœè±¡ãã¿ã€ã, ãã匷åãªæœè±¡åãã§ããããã«åªããŠãªããã°ãªããªã.
é«éæç¶ãã®éèŠãã¯, ããã«ããæœè±¡ãããã°ã©ã èšèªã®èŠçŽ ããŠç¢ºãã«è¡šã, ä»ã®èšç®èŠçŽ ãšããŠæ±ããããã«ãªãç¹ã«ãã.
Chapter 2:: Building Abstractions with Data
Chapter 3:: Modularity, Objects, and State
Chapter 4:: Metalinguistic Abstraction
Chapter 5:: Computing with Register Machines
Topics
Insights
2015ã«èªã¿é²ããŠæ«æ. ãŸãææŠããã.
ðžSICPãé£ãããŠèªåã®é ã®æªããæããããšãäŒè·ã®ãã£ããã®ã²ãšã€
â«äŒç€Ÿã«2é±éé£ç¶ã§é å»ããŠäŒç€ŸãäŒè·(2015/12)ã®ãã£ããã¯SCIPã®æ«æäœéš.
å°ããªæ«æçµéšãšããŠäŒè·ã®å幎åã«SICPã®é£ããã«æã¡ã®ããããŠã¡ã³ã¿ã«ãå¹ãã . å°ããªæ«æãéªã ããŸã®ããã«å€§ãããªã£ãŠäŒè·ã«ããã£ã. ããã¯ææäœéšã§ãããšãšãã«, å æããã¹ã人çã®èª²é¡ã .
ðClojureãåŠã¶ããšã¯SICPã®æ«æäœéšãå æããããš(2022/10/13)
ããã¯æéããããã°å¿ ãç解ã§ãããã®ã§ãã, 倧äºãªã®ã¯é£ããã«æã¡ã®ããããŠåŠç¿ããããªãããšã . æ«æããªããã°å¿ ãç解ã§ãã.
- âšåŒ·ãã®ã»ã«ãã³ã³ããã·ã§ã³ã§å€±æããåŠã¶åæ°ãåŸã
- #æ«æãã
- ð±é£ãããŠããããªããšãã¯èªåã«åªãããã
References
- Welcome to SICP Distilled
- Clojureã«ããSICPãªãã€ãã«?
- 匱LisperãMITã§SICP(ã·ã¯ããŒ)ãåè¬ããçµæ - Qiita