<?xml version="1.0" encoding="utf-8"?>
<!-- generator="FeedCreator 1.7.2-ppt DokuWiki" -->
<?xml-stylesheet href="http://wiki.dgoon.net/lib/exe/css.php?s=feed" type="text/css"?>
<rss version="2.0">
    <channel>
        <title>D-Goon's Doc</title>
        <description></description>
        <link>http://wiki.dgoon.net/</link>
        <lastBuildDate>Thu, 23 Feb 2012 12:39:46 +0900</lastBuildDate>
        <generator>FeedCreator 1.7.2-ppt DokuWiki</generator>
        <image>
            <url>http://wiki.dgoon.net/lib/tpl/default/images/favicon.ico</url>
            <title>D-Goon's Doc</title>
            <link>http://wiki.dgoon.net/</link>
        </image>
        <item>
            <title>htdp:chapter_6 - [Compound] </title>
            <link>http://wiki.dgoon.net/doku.php?id=htdp:chapter_6</link>
            <description>
&lt;h1 class=&quot;sectionedit1&quot;&gt;&lt;a name=&quot;htdp&quot; id=&quot;htdp&quot;&gt;HTDP&lt;/a&gt;&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;/div&gt;
&lt;!-- EDIT1 SECTION &quot;HTDP&quot; [1-19] --&gt;
&lt;h2 class=&quot;sectionedit2&quot;&gt;&lt;a name=&quot;chapter_6&quot; id=&quot;chapter_6&quot;&gt;Chapter 6&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;/div&gt;
&lt;!-- EDIT2 SECTION &quot;Chapter 6&quot; [20-42] --&gt;
&lt;h3 class=&quot;sectionedit3&quot;&gt;&lt;a name=&quot;compound&quot; id=&quot;compound&quot;&gt;Compound&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;
 우리는 여러개의 값을 묶어서 하나의 자료로 표현한다. 이런 묶음 자료를 다루기 위해서는 값을 묶는 함수(make-posn)와, 묶인 자료에서 원래의 값을 하나하나 추출하는 함수(posn-x, posn-y)가 필요하다.
&lt;/p&gt;

&lt;p&gt;
 여러 개의 함수 실행이 필요한 경우, 각 함수가 true를 리턴한다면
&lt;/p&gt;

&lt;p&gt;
&lt;pre name=&quot;code&quot; class=&quot;html&quot;&gt;
(and exp1 exp2 exp3 ...)
&lt;/pre&gt;
&lt;/p&gt;

&lt;p&gt;
와 같은 식으로 조합할 수 있다.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT3 SECTION &quot;Compound&quot; [43-498] --&gt;
&lt;h3 class=&quot;sectionedit4&quot;&gt;&lt;a name=&quot;code&quot; id=&quot;code&quot;&gt;Code&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://git.dgoon.net/?p=kata.git;a=tree;f=HTDP/chapter-06&quot; class=&quot;urlextern&quot; title=&quot;http://git.dgoon.net/?p=kata.git;a=tree;f=HTDP/chapter-06&quot;  rel=&quot;nofollow&quot;&gt;http://git.dgoon.net/?p=kata.git;a=tree;f=HTDP/chapter-06&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT4 SECTION &quot;Code&quot; [499-] --&gt;</description>
            <author>dgoon</author>
        <category>htdp</category>
            <pubDate>Fri, 17 Feb 2012 00:02:54 +0900</pubDate>
        </item>
        <item>
            <title>python:requests</title>
            <link>http://wiki.dgoon.net/doku.php?id=python:requests</link>
            <description>
&lt;h2 class=&quot;sectionedit5&quot;&gt;&lt;a name=&quot;requests&quot; id=&quot;requests&quot;&gt;Requests&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
Requests는 파이썬으로 쓰인 &lt;acronym title=&quot;Hyper Text Transfer Protocol&quot;&gt;HTTP&lt;/acronym&gt; 라이브러리이다. 관련 페이지는 &lt;a href=&quot;http://docs.python-requests.org/en/latest/index.html&quot; class=&quot;urlextern&quot; title=&quot;http://docs.python-requests.org/en/latest/index.html&quot;  rel=&quot;nofollow&quot;&gt;http://docs.python-requests.org/en/latest/index.html&lt;/a&gt; 여기에 있다. 파이썬 빌트인 httplib, urllib 보다 사용하기 쉬우며, gevent(&lt;a href=&quot;http://www.gevent.org/&quot; class=&quot;urlextern&quot; title=&quot;http://www.gevent.org/&quot;  rel=&quot;nofollow&quot;&gt;http://www.gevent.org/&lt;/a&gt;)가 설치된 경우 비동기 동작을 할 수 있다. requests, gevent 모두 pip(&lt;a href=&quot;http://pypi.python.org/pypi/pip&quot; class=&quot;urlextern&quot; title=&quot;http://pypi.python.org/pypi/pip&quot;  rel=&quot;nofollow&quot;&gt;http://pypi.python.org/pypi/pip&lt;/a&gt;)로 설치할 수 있다.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT5 SECTION &quot;Requests&quot; [1-417] --&gt;
&lt;h3 class=&quot;sectionedit6&quot;&gt;&lt;a name=&quot;basic_get&quot; id=&quot;basic_get&quot;&gt;Basic GET&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;
기본적인 사용법은 아주 간단하다. GET메소드로 주어진 URL을 가지고 오는 것은,
&lt;/p&gt;

&lt;p&gt;
&lt;pre name=&quot;code&quot; class=&quot;html&quot;&gt;
import requests
r = requests.get(URL)
&lt;/pre&gt;
&lt;/p&gt;

&lt;p&gt;
이렇게 끝난다. 예를 들어, &lt;a href=&quot;http://cfs7.tistory.com/upload_control/download.blog?fhandle=YmxvZzUzNDk3QGZzNy50aXN0b3J5LmNvbTovYXR0YWNoLzAvMDcwMDAwMDAwMDAwLnBuZw%3D%3D&quot; class=&quot;urlextern&quot; title=&quot;http://cfs7.tistory.com/upload_control/download.blog?fhandle=YmxvZzUzNDk3QGZzNy50aXN0b3J5LmNvbTovYXR0YWNoLzAvMDcwMDAwMDAwMDAwLnBuZw%3D%3D&quot;  rel=&quot;nofollow&quot;&gt;http://cfs7.tistory.com/upload_control/download.blog?fhandle=YmxvZzUzNDk3QGZzNy50aXN0b3J5LmNvbTovYXR0YWNoLzAvMDcwMDAwMDAwMDAwLnBuZw%3D%3D&lt;/a&gt; 이 이미지를 저장한다고 하면,
&lt;/p&gt;

&lt;p&gt;
&lt;pre name=&quot;code&quot; class=&quot;html&quot;&gt;
import requests
URL=&amp;quot;http://cfs7.tistory.com/upload_control/download.blog?fhandle=YmxvZzUzNDk3QGZzNy50aXN0b3J5LmNvbTovYXR0YWNoLzAvMDcwMDAwMDAwMDAwLnBuZw%3D%3D&amp;quot;
r = requests.get(URL)
with open(&amp;quot;test.png&amp;quot;, &amp;quot;wb&amp;quot;) as f:
    f.write(r.content)
&lt;/pre&gt;
&lt;/p&gt;

&lt;p&gt;
이렇게 하면 된다. 응답을 들고 있는 객체 &lt;strong&gt;r&lt;/strong&gt; 에서 r.text, r.content, r.headers, r.status_code 등의 값을 사용할 수 있다. 요청에 대해서 타임아웃을 주고 싶을 때에는 &lt;em&gt;get&lt;/em&gt; 메소드에 &lt;strong&gt;timeout=0.01&lt;/strong&gt; 처럼 초 단위로 타임아웃을 지정해 줄 수 있다.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT6 SECTION &quot;Basic GET&quot; [418-] --&gt;</description>
            <author>dgoon</author>
        <category>python</category>
            <pubDate>Thu, 09 Feb 2012 16:05:36 +0900</pubDate>
        </item>
        <item>
            <title>worklog - [삽질기록] </title>
            <link>http://wiki.dgoon.net/doku.php?id=worklog</link>
            <description>
&lt;h1 class=&quot;sectionedit7&quot;&gt;&lt;a name=&quot;work_log&quot; id=&quot;work_log&quot;&gt;Work log&lt;/a&gt;&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
디군의 잡다한 작업/스터디/발표 기록들. 잊기 전에 정리하자 - 정신으로 쓰여진 날림 문서들이다. &lt;del&gt;일종의 Tools and Tips 라고 볼수도…&lt;/del&gt; 최소한 하나의 페이지 정도를 요구하는 삽질의 기록.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT7 SECTION &quot;Work log&quot; [1-282] --&gt;
&lt;h2 class=&quot;sectionedit8&quot;&gt;&lt;a name=&quot;삽질기록&quot; id=&quot;삽질기록&quot;&gt;삽질기록&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://wiki.dgoon.net/doku.php?id=config:trac_svn_ssl_%EC%84%A4%EC%A0%95&quot; class=&quot;wikilink1&quot; title=&quot;config:trac_svn_ssl_설정&quot;&gt;TRAC+SVN+SSL 설정&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://wiki.dgoon.net/doku.php?id=debian:howtomakeadebianpackage&quot; class=&quot;wikilink1&quot; title=&quot;debian:howtomakeadebianpackage&quot;&gt;HowToMakeADebianPackage&lt;/a&gt; - Getting started&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://wiki.dgoon.net/doku.php?id=misc:sshtunneling&quot; class=&quot;wikilink1&quot; title=&quot;misc:sshtunneling&quot;&gt;SSH 터널링&lt;/a&gt; - 가끔 정말 유용하게 쓰인다&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://wiki.dgoon.net/doku.php?id=config:installredmine&quot; class=&quot;wikilink1&quot; title=&quot;config:installredmine&quot;&gt;InstallRedmine&lt;/a&gt; - 레드마인 설치부터 디플로이까지&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://wiki.dgoon.net/doku.php?id=clojure:config&quot; class=&quot;wikilink1&quot; title=&quot;clojure:config&quot;&gt;config&lt;/a&gt; - 클로져&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://wiki.dgoon.net/doku.php?id=misc:dwiki&quot; class=&quot;wikilink1&quot; title=&quot;misc:dwiki&quot;&gt;dwiki&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://wiki.dgoon.net/doku.php?id=misc:mergevideofiles&quot; class=&quot;wikilink1&quot; title=&quot;misc:mergevideofiles&quot;&gt;MergeVideoFiles&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://wiki.dgoon.net/doku.php?id=misc:stockinfo&quot; class=&quot;wikilink1&quot; title=&quot;misc:stockinfo&quot;&gt;StockInfo&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://wiki.dgoon.net/doku.php?id=misc:capturedvb&quot; class=&quot;wikilink1&quot; title=&quot;misc:capturedvb&quot;&gt;CaptureDVB&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://wiki.dgoon.net/doku.php?id=misc:ffmpeg0.8api&quot; class=&quot;wikilink1&quot; title=&quot;misc:ffmpeg0.8api&quot;&gt;FFMpeg0.8API&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://wiki.dgoon.net/doku.php?id=webinpython&quot; class=&quot;wikilink1&quot; title=&quot;webinpython&quot;&gt;WebInPython&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://wiki.dgoon.net/doku.php?id=db:pythonmysql&quot; class=&quot;wikilink1&quot; title=&quot;db:pythonmysql&quot;&gt;Python에서 MySQL에 접근하기&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://wiki.dgoon.net/doku.php?id=xml:lxml&quot; class=&quot;wikilink1&quot; title=&quot;xml:lxml&quot;&gt;lxml&lt;/a&gt; - Handle &lt;acronym title=&quot;Extensible Markup Language&quot;&gt;XML&lt;/acronym&gt; document in python&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://wiki.dgoon.net/doku.php?id=python:decorator&quot; class=&quot;wikilink1&quot; title=&quot;python:decorator&quot;&gt;파이썬 데코레이터:살짝 들여다보기&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://wiki.dgoon.net/doku.php?id=python:filestat&quot; class=&quot;wikilink1&quot; title=&quot;python:filestat&quot;&gt;파일 정보 읽기&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://wiki.dgoon.net/doku.php?id=python:pyunit&quot; class=&quot;wikilink1&quot; title=&quot;python:pyunit&quot;&gt;파이썬 유닛테스트 간단한 입문&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://wiki.dgoon.net/doku.php?id=python:time_-_string&quot; class=&quot;wikilink1&quot; title=&quot;python:time_-_string&quot;&gt;Time&amp;lt;-&amp;gt;String&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://wiki.dgoon.net/doku.php?id=python:profiling&quot; class=&quot;wikilink1&quot; title=&quot;python:profiling&quot;&gt;Profiling&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://wiki.dgoon.net/doku.php?id=coding:weechatpythonbot&quot; class=&quot;wikilink1&quot; title=&quot;coding:weechatpythonbot&quot;&gt;초 간단한 위챗 봇 만들기 입문&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://wiki.dgoon.net/doku.php?id=python:binding&quot; class=&quot;wikilink2&quot; title=&quot;python:binding&quot; rel=&quot;nofollow&quot;&gt;binding&lt;/a&gt; - Python-C/C++ 바인딩&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://wiki.dgoon.net/doku.php?id=ssl:ssl&quot; class=&quot;wikilink1&quot; title=&quot;ssl:ssl&quot;&gt;ssl&lt;/a&gt; - &lt;acronym title=&quot;Secure Sockets Layer&quot;&gt;SSL&lt;/acronym&gt; 위에서 통신하기&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://wiki.dgoon.net/doku.php?id=python:requests&quot; class=&quot;wikilink1&quot; title=&quot;python:requests&quot;&gt;requests&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT8 SECTION &quot;삽질기록&quot; [283-1267] --&gt;
&lt;h2 class=&quot;sectionedit9&quot;&gt;&lt;a name=&quot;발표기록&quot; id=&quot;발표기록&quot;&gt;발표기록&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://wiki.dgoon.net/doku.php?id=latex:latex&quot; class=&quot;wikilink1&quot; title=&quot;latex:latex&quot;&gt;LaTeX&lt;/a&gt; - 정말정말 심플한 LaTeX 시작하기 @ SICP Studygroup 6월모임(2008) 발표&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://wiki.dgoon.net/doku.php?id=misc:mapreduce&quot; class=&quot;wikilink1&quot; title=&quot;misc:mapreduce&quot;&gt;Map/Reduce 초간단발표&lt;/a&gt; @ SICP Studygroup 9월모임(2008) 발표&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://wiki.dgoon.net/doku.php?id=misc:dht_chord&quot; class=&quot;wikilink2&quot; title=&quot;misc:dht_chord&quot; rel=&quot;nofollow&quot;&gt;DHT/Chord&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT9 SECTION &quot;발표기록&quot; [1268-] --&gt;</description>
            <author>dgoon</author>
            <pubDate>Thu, 09 Feb 2012 14:11:32 +0900</pubDate>
        </item>
        <item>
            <title>private:책목록 - [비문학] </title>
            <link>http://wiki.dgoon.net/doku.php?id=private:%EC%B1%85%EB%AA%A9%EB%A1%9D</link>
            <description>
&lt;h2 class=&quot;sectionedit10&quot;&gt;&lt;a name=&quot;디군의_책_리스트&quot; id=&quot;디군의_책_리스트&quot;&gt;디군의 책 리스트&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
별도의 관리 툴을 만들기 전까지, 일단 목록이라도 있어야 할 것 같아서 정리.
전공서적의 경우 번역서는 별도 표시, 그 외의 경우는 원서를 별도 표기. 둘 다 있는 경우는 둘다 써서 구분. 원서는 가능한 경우 제목도 해당 언어로.
&lt;/p&gt;

&lt;p&gt;
- 상자에서 안꺼낸 책들 어쩔꺼야 ㅠㅠ
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT10 SECTION &quot;디군의 책 리스트&quot; [1-392] --&gt;
&lt;h3 class=&quot;sectionedit11&quot;&gt;&lt;a name=&quot;전공&quot; id=&quot;전공&quot;&gt;전공&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; TAOCP Vol.1&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; TAOCP Vol.2&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; TAOCP Vol.3&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; TAOCP Fascicles 0, 1, 2, 3, 4 of Vol.4&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Concrete mathematics&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; SICP&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Beyond the C++ Standard Library &lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; C++ Standard library&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Data Mining&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Artificial Intelligence&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 유닉스 시스템 프로그래밍 SVR 4(번역)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 실용주의 프로그래머&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 이펙티브 STL&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Pro Android 2 (EBOOK)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Agile Web Development with Rails (EBOOK)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Programming Erlang (EBOOK)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Programming in Clojure (EBOOK)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 프로토타이핑&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 프로그램 디자인 어떻게 할 것인가&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT11 SECTION &quot;전공&quot; [393-960] --&gt;
&lt;h3 class=&quot;sectionedit12&quot;&gt;&lt;a name=&quot;cs_관련_비전공&quot; id=&quot;cs_관련_비전공&quot;&gt;CS 관련(?) 비전공&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 사랑하지 않으면 떠나라&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 고약한 문제, 합당한 해결&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; G.E.B. (원서)&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT12 SECTION &quot;CS 관련(?) 비전공&quot; [961-1090] --&gt;
&lt;h3 class=&quot;sectionedit13&quot;&gt;&lt;a name=&quot;문학&quot; id=&quot;문학&quot;&gt;문학&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 파우스트 1/2&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 기형도 전집&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 이상한 나라의 앨리스&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 거울 나라의 앨리스&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 時をかける少女(시간을 달리는 소녀) (원서)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 꿈꾸는 책들의 도시 1/2&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 폐도 1/2/3&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 아서 클라크 단편 전집&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 미인계&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 천개의 찬란한 태양&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 눈먼 자들의 도시&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 한 권으로 읽는 잃어버린 시간을 찾아서&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 차라투스트라는 이렇게 말했다&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 전도서에 바치는 장미&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 키리냐가&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 지식의 역사&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 지식의 단련법&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 성의 패러독스&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT13 SECTION &quot;문학&quot; [1091-1662] --&gt;
&lt;h3 class=&quot;sectionedit14&quot;&gt;&lt;a name=&quot;비문학&quot; id=&quot;비문학&quot;&gt;비문학&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 전략의 탄생&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 한용운의 채근담 강의&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Lewis Carol and Alice&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 듀이 (clover3leaf → 디군 → 하프리)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; The Secret&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 이기주의를 위한 변명&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 교과서가 죽인 책들&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 여행의 기술&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://hyeranh.net/1628&quot; class=&quot;urlextern&quot; title=&quot;http://hyeranh.net/1628&quot;  rel=&quot;nofollow&quot;&gt;함께 읽으면 즐겁습니다&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 러셀의 행복론&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 나는 왜 기독교인이 아닌가&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 게으름에 대한 찬양&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 파인만의 또 다른 물리학 강의&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 워킹 푸어, 빈곤의 경계에서 말하다&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 정의란 무엇인가&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 최초의 신화 길가메쉬 서사시&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 소크라테스의 변명&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 공부는 내 인생에 대한 예의다&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 홀가분&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 지식의 단련법&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT14 SECTION &quot;비문학&quot; [1663-2354] --&gt;
&lt;h3 class=&quot;sectionedit15&quot;&gt;&lt;a name=&quot;nt류&quot; id=&quot;nt류&quot;&gt;NT류&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 공의 경계 상/중/하 (원서)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 공의 경계 상/하 (번역)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 하루카 천공의 야마타이국&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 하루카 염천의 야마타이국 (완결)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 잘린머리 사이클&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 목조르는 로맨티스트&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 목매다는 하이스쿨&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 사이코로지컬 상/하&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT15 SECTION &quot;NT류&quot; [2355-2655] --&gt;
&lt;h3 class=&quot;sectionedit16&quot;&gt;&lt;a name=&quot;만화&quot; id=&quot;만화&quot;&gt;만화&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 3月のライオン 1~5 (원서)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 3월의 라이온 1~5 (번역)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 카페알파 전권(1~14) (번역)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 허니와 클로버 전권(0~10) (번역)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 마이걸 1~3 (번역)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Nabi 1~8&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Nabi 단편집&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Fly&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 맑은 봄빛 사랑 이야기 - 모모네&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 별의 목소리&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 버스 달리다&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 멸망한 짐승들의 바다&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 블루홀 1/2&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 문로스트 1/2&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 소용돌디 1~3&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 예스터데이를 노래하며 1~7 (번역)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Tom Sawyer (번역)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 신부 이야기 1,2 (번역)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 치키타 구구 1~8 (번역)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 문화 콘텐츠의 이해&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 마니마니&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 붉은 딸기 흰 딸기&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 진격의 거인 1,2,3,4 (번역)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 토끼 드롭스 1~6&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 스트로보라이트&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT16 SECTION &quot;만화&quot; [2656-3387] --&gt;
&lt;h3 class=&quot;sectionedit17&quot;&gt;&lt;a name=&quot;예술&quot; id=&quot;예술&quot;&gt;예술&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 강병규 지리산 사진집&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 연필 하나로 시작하는 스케치 연습장&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Life &amp;amp; Nature - 내셔널 지오그래픽전 대도록&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT17 SECTION &quot;예술&quot; [3388-] --&gt;</description>
            <author>dgoon</author>
        <category>private</category>
            <pubDate>Sat, 29 Oct 2011 14:32:58 +0900</pubDate>
        </item>
        <item>
            <title>sicp:exercise_ch5.4 - [Ex 5.30] </title>
            <link>http://wiki.dgoon.net/doku.php?id=sicp:exercise_ch5.4</link>
            <description>
&lt;h1 class=&quot;sectionedit18&quot;&gt;&lt;a name=&quot;sicp&quot; id=&quot;sicp&quot;&gt;SICP&lt;/a&gt;&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;/div&gt;
&lt;!-- EDIT18 SECTION &quot;SICP&quot; [1-20] --&gt;
&lt;h2 class=&quot;sectionedit19&quot;&gt;&lt;a name=&quot;exercises_on_chapter_54&quot; id=&quot;exercises_on_chapter_54&quot;&gt;Exercises on Chapter 5.4&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;/div&gt;
&lt;!-- EDIT19 SECTION &quot;Exercises on Chapter 5.4&quot; [21-59] --&gt;
&lt;h3 class=&quot;sectionedit20&quot;&gt;&lt;a name=&quot;ex_523&quot; id=&quot;ex_523&quot;&gt;Ex 5.23&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;
Extend the evaluator to handle derived expressions such as &lt;em&gt;cond&lt;/em&gt;, &lt;em&gt;let&lt;/em&gt;, and so on (seciton 4.1.2). You may “cheat” and assume that the syntax transformers such as &lt;em&gt;cond→if&lt;/em&gt; are available as machine operations.
&lt;/p&gt;

&lt;p&gt;
&lt;em&gt;cond?&lt;/em&gt;, &lt;em&gt;cond→if&lt;/em&gt; 가 이미 있다는 가정을 하면 아주 쉽다. &lt;em&gt;eceval-operations&lt;/em&gt; 에 
&lt;/p&gt;

&lt;p&gt;
&lt;pre name=&quot;code&quot; class=&quot;html&quot;&gt;
   ;; Exercise 5.23
   (list &amp;#039;cond? cond?)
   (list &amp;#039;cond-&amp;gt;if cond-&amp;gt;if)
&lt;/pre&gt;
&lt;/p&gt;

&lt;p&gt;
이렇게 두 줄을 추가해준다. &lt;em&gt;cond?&lt;/em&gt;, &lt;em&gt;cond→if&lt;/em&gt; 의 구현은 4장에서 빌려온다. 그리고 &lt;em&gt;eval-dispatch&lt;/em&gt; 에서,
&lt;/p&gt;

&lt;p&gt;
&lt;pre name=&quot;code&quot; class=&quot;html&quot;&gt;
  ;; Exercise 5.23
  (test (op cond?) (reg exp))
  (branch (label ev-cond))
  ;; ----
&lt;/pre&gt;
&lt;/p&gt;

&lt;p&gt;
이렇게 해당 operation을 잡아서 점프를 해 주고, 저것을 받는 ev-cond 를 만들면 된다. ev-cond의 구현은 &lt;em&gt;cond→if&lt;/em&gt; 가 된다. &lt;em&gt;exp&lt;/em&gt;에 변환된 &lt;strong&gt;if&lt;/strong&gt; 문을 넣은 다음, 이걸 처리하기 위해 &lt;strong&gt;ev-if&lt;/strong&gt; 로 가면 끝.
&lt;/p&gt;

&lt;p&gt;
&lt;pre name=&quot;code&quot; class=&quot;html&quot;&gt;
ev-cond
  (assign exp (op cond-&amp;gt;if) (reg exp))
  (goto (label ev-if))
&lt;/pre&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://study-sicp.googlecode.com/svn/trunk/chapter-05/ex5.23-dgoon.scm&quot; class=&quot;urlextern&quot; title=&quot;http://study-sicp.googlecode.com/svn/trunk/chapter-05/ex5.23-dgoon.scm&quot;  rel=&quot;nofollow&quot;&gt;http://study-sicp.googlecode.com/svn/trunk/chapter-05/ex5.23-dgoon.scm&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT20 SECTION &quot;Ex 5.23&quot; [60-1150] --&gt;
&lt;h3 class=&quot;sectionedit21&quot;&gt;&lt;a name=&quot;ex_524&quot; id=&quot;ex_524&quot;&gt;Ex 5.24&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;
Implement &lt;em&gt;cond&lt;/em&gt; as a new basic special form without reducing it to &lt;em&gt;if&lt;/em&gt;. You will have to construct a loop that tests the predicates of successive &lt;em&gt;cond&lt;/em&gt; clauses until you find one that is true, and then use &lt;em&gt;ev-sequence&lt;/em&gt; to evaluate the actions of the clause.
&lt;/p&gt;

&lt;p&gt;
위 5.23 의 &lt;em&gt;ev-cond&lt;/em&gt; 부분을 &lt;em&gt;cond→if&lt;/em&gt; 대신 machine language 로 직접 구현하라는 문제이다. 디버깅이 어려워서 꽤 오래 걸렸다. 풀이 후반에 추가한 &lt;em&gt;print&lt;/em&gt; 함수가 아주 큰 도움이 되었다. 일단 아래와 같이 cond 관련 함수들과 &lt;em&gt;print&lt;/em&gt; 를 함께 추가하자. &lt;em&gt;print&lt;/em&gt; 는,
&lt;/p&gt;

&lt;p&gt;
&lt;pre name=&quot;code&quot; class=&quot;html&quot;&gt;
(perform (op print) (reg exp))
&lt;/pre&gt;
&lt;/p&gt;

&lt;p&gt;
이런 식으로 레지스터의 내용을 찍어볼 수 있고, 없으면 디버깅이 거의 불가하다. … -_-a
&lt;/p&gt;

&lt;p&gt;
&lt;pre name=&quot;code&quot; class=&quot;html&quot;&gt;
(define print (lambda (x) (display x)(newline)))
(define eceval-operations
  (list
    ...
    ...
       ;; Exercise 5.23
   (list &amp;#039;cond? cond?)
   ;(list &amp;#039;cond-&amp;gt;if cond-&amp;gt;if) ;; Exercise 5.24 doesn&amp;#039;t use it.
   (list &amp;#039;cond-clauses cond-clauses)
   (list &amp;#039;cond-predicate cond-predicate)
   (list &amp;#039;cond-actions cond-actions)
   ;; for debug
   (list &amp;#039;print print)
   ))
&lt;/pre&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;em&gt;eval-dispatch&lt;/em&gt; 에서는 그냥 &lt;em&gt;ev-cond&lt;/em&gt; 로 점프한다.
&lt;/p&gt;

&lt;p&gt;
&lt;pre name=&quot;code&quot; class=&quot;html&quot;&gt;
  ;; Exercise 5.23, 5.24
  (test (op cond?) (reg exp))
  (branch (label ev-cond))
  ;; ----
&lt;/pre&gt;
&lt;/p&gt;

&lt;p&gt;
아래는 &lt;em&gt;ev-cond&lt;/em&gt; 로부터 시작되는 실제 구현부이다. 귀찮아서 &lt;strong&gt;else&lt;/strong&gt; 처리는 하지 않았다. 맞는 조건이 하나도 없거나 else 를 만나면 에러가 난다.
&lt;/p&gt;

&lt;p&gt;
&lt;pre name=&quot;code&quot; class=&quot;html&quot;&gt;
;; Exercise 5.24
ev-cond
  (assign exp (op cond-clauses) (reg exp)) ; now exp has clauses
  (save continue)
ev-cond-body
  (save exp)
  (save env)
  (assign continue (label ev-cond-loop))
  (assign unev (op first-exp) (reg exp)) ; unev is now A CLAUSE
  (assign exp (op cond-predicate) (reg unev)) ; exp is now A PREDICATE of A CLAUSE

  ;; (perform (op print) (reg exp)) ;; debug msg

  (goto (label eval-dispatch))
ev-cond-loop
  (restore env)
  (restore exp)
  (test (op true?) (reg val))
  (branch (label ev-cond-out))
  (assign exp (op rest-exps) (reg exp))
  (goto (label ev-cond-body))

ev-cond-out
  ;(restore continue) ;; becasue we&amp;#039;ll directly jump into ev-sequence, not ev-begin
  ;(perform (op print) (reg exp)) ;; debug msg

  (assign unev (op first-exp) (reg exp)) ; unev is A CLAUSE which will be returned
  (assign exp (op cond-actions) (reg unev)) ; exp is ACTIONs!

  ;(perform (op print) (reg exp)) ;; debug msg

  (goto (label ev-sequence))
;; -----
&lt;/pre&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://study-sicp.googlecode.com/svn/trunk/chapter-05/ex5.24-dgoon.scm&quot; class=&quot;urlextern&quot; title=&quot;http://study-sicp.googlecode.com/svn/trunk/chapter-05/ex5.24-dgoon.scm&quot;  rel=&quot;nofollow&quot;&gt;http://study-sicp.googlecode.com/svn/trunk/chapter-05/ex5.24-dgoon.scm&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT21 SECTION &quot;Ex 5.24&quot; [1151-3759] --&gt;
&lt;h3 class=&quot;sectionedit22&quot;&gt;&lt;a name=&quot;ex_525&quot; id=&quot;ex_525&quot;&gt;Ex 5.25&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;
Modify the evaluator so that it uses normal-order evaluation, based on the lazy evaluator of section 4.2.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT22 SECTION &quot;Ex 5.25&quot; [3760-3884] --&gt;
&lt;h3 class=&quot;sectionedit23&quot;&gt;&lt;a name=&quot;ex_526&quot; id=&quot;ex_526&quot;&gt;Ex 5.26&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;
 Use the monitored stack to explore the tail-recursive property of the evaluator (section 5.4.2). Start the evaluator and define the iterative &lt;em&gt;factorial&lt;/em&gt; procedure from section 1.2.1:
&lt;/p&gt;

&lt;p&gt;
(define (factorial n)
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;(define (iter product counter)
  (if (&amp;gt; counter n)
      product
      (iter (* counter product)
            (+ counter 1))))
(iter 1 1))&lt;/pre&gt;

&lt;p&gt;
Run the procedure with some small values of &lt;em&gt;n&lt;/em&gt;. Record the maximum stack depth and the number of pushes required to compute &lt;em&gt;n&lt;/em&gt;! for each of these values.
&lt;/p&gt;

&lt;p&gt;
a. You will find that the maximum depth required to evaluate n! is independent of &lt;em&gt;n&lt;/em&gt;. What is that depth?
&lt;/p&gt;

&lt;p&gt;
앞에 나왔던 monitored stack을 구현하고 위 코드로 1부터 10까지에 대해서 답을 구해 보았다. print-statistics 의 결과만 모아보면 아래와 같다.
&lt;pre name=&quot;code&quot; class=&quot;html&quot;&gt;
(total-pushes = 3 maximum-depth = 3)
(total-pushes = 64 maximum-depth = 10)
(total-pushes = 99 maximum-depth = 10)
(total-pushes = 134 maximum-depth = 10)
(total-pushes = 169 maximum-depth = 10)
(total-pushes = 204 maximum-depth = 10)
(total-pushes = 239 maximum-depth = 10)
(total-pushes = 274 maximum-depth = 10)
(total-pushes = 309 maximum-depth = 10)
(total-pushes = 344 maximum-depth = 10)
(total-pushes = 379 maximum-depth = 10)
&lt;/pre&gt;
처음 한 번은 &lt;em&gt;factorial&lt;/em&gt; 함수를 정의할 때이므로 제외하고을 나머지의 스택 깊이는 10으로 일정하다.
&lt;/p&gt;

&lt;p&gt;
b. Determine from your data a formula in terms of n for the total number of push operations used in evaluating &lt;em&gt;n&lt;/em&gt;! for any &lt;em&gt;n&lt;/em&gt; &amp;gt; 1. Note that the number of operations used is a linear function of &lt;em&gt;n&lt;/em&gt; and is thus determined by two constants.
&lt;/p&gt;
&lt;div class=&quot;table sectionedit24&quot;&gt;&lt;table class=&quot;inline&quot;&gt;
	&lt;tr class=&quot;row0&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; n &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; 2 &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; 3 &lt;/td&gt;&lt;td class=&quot;col3&quot;&gt; 4 &lt;/td&gt;&lt;td class=&quot;col4&quot;&gt; 5 &lt;/td&gt;&lt;td class=&quot;col5&quot;&gt; 6 &lt;/td&gt;&lt;td class=&quot;col6&quot;&gt; 7 &lt;/td&gt;&lt;td class=&quot;col7&quot;&gt; 8 &lt;/td&gt;&lt;td class=&quot;col8&quot;&gt; 9 &lt;/td&gt;&lt;td class=&quot;col9&quot;&gt; 10 &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row1&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; # of pushes &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; 99 &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; 134 &lt;/td&gt;&lt;td class=&quot;col3&quot;&gt; 169 &lt;/td&gt;&lt;td class=&quot;col4&quot;&gt; 204 &lt;/td&gt;&lt;td class=&quot;col5&quot;&gt; 239 &lt;/td&gt;&lt;td class=&quot;col6&quot;&gt; 274 &lt;/td&gt;&lt;td class=&quot;col7&quot;&gt; 309 &lt;/td&gt;&lt;td class=&quot;col8&quot;&gt; 344 &lt;/td&gt;&lt;td class=&quot;col9&quot;&gt; 379 &lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;!-- EDIT24 TABLE [5550-5661] --&gt;
&lt;p&gt;
&lt;em&gt;n&lt;/em&gt;이 1 증가할 때마다 # of pushes 는 35씩 일정하게 증가하고 있다는 것을 알 수 있다. 1차 함수이므로, 1차식을 만들어 표현하면 아래와 같다.
&lt;/p&gt;

&lt;p&gt;
&lt;strong&gt;# of pushes = 35n + 29&lt;/strong&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT23 SECTION &quot;Ex 5.26&quot; [3885-5876] --&gt;
&lt;h3 class=&quot;sectionedit25&quot;&gt;&lt;a name=&quot;ex_527&quot; id=&quot;ex_527&quot;&gt;Ex 5.27&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;
For comparison with exercise 5.26, explore the behavior of the following procedure for computing factorials recursively:
&lt;/p&gt;

&lt;p&gt;
&lt;pre name=&quot;code&quot; class=&quot;html&quot;&gt;
(define (factorial n)
  (if (= n 1)
      1
      (* (factorial (- n 1)) n)))
&lt;/pre&gt;
&lt;/p&gt;

&lt;p&gt;
By running this procedure with the monitored stack, determine, as a function of &lt;em&gt;n&lt;/em&gt;, the maximum depth of the stack and the total number of pushes used in evaluating &lt;em&gt;n&lt;/em&gt;! for &lt;em&gt;n&lt;/em&gt; &amp;gt; 1. (Again, these functions will be linear.) Summarize your experiments by filling in the following table with the appropriate expressions in terms of &lt;em&gt;n&lt;/em&gt;:
&lt;/p&gt;
&lt;div class=&quot;table sectionedit26&quot;&gt;&lt;table class=&quot;inline&quot;&gt;
	&lt;tr class=&quot;row0&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; &lt;/td&gt;&lt;td class=&quot;col1 leftalign&quot;&gt; Maximum depth	&lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; Number of pushes &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row1&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; Recursive factorial &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; 5n+3 &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; 32n-16 &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row2&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; Iterative factorial &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; 10 &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; 35n+29 &lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;!-- EDIT26 TABLE [6456-6572] --&gt;
&lt;p&gt;
The maximum depth is a measure of the amount of space used by the evaluator in carrying out the computation, and the number of pushes correlates well with the time required.
&lt;/p&gt;

&lt;p&gt;
일단 위와 같이 재귀적인 &lt;em&gt;factorial&lt;/em&gt; 에 대해서도 1부터 10까지의 &lt;em&gt;n&lt;/em&gt; 을 넣어 &lt;em&gt;print-statistics&lt;/em&gt; 의 결과를 뽑아 보았다.
&lt;pre name=&quot;code&quot; class=&quot;html&quot;&gt;
(total-pushes = 3 maximum-depth = 3)
(total-pushes = 16 maximum-depth = 8)
(total-pushes = 48 maximum-depth = 13)
(total-pushes = 80 maximum-depth = 18)
(total-pushes = 112 maximum-depth = 23)
(total-pushes = 144 maximum-depth = 28)
(total-pushes = 176 maximum-depth = 33)
(total-pushes = 208 maximum-depth = 38)
(total-pushes = 240 maximum-depth = 43)
(total-pushes = 272 maximum-depth = 48)
(total-pushes = 304 maximum-depth = 53)
&lt;/pre&gt;
&lt;/p&gt;

&lt;p&gt;
연습문제 5.26과는 다르게 maximum-depth가 계속 증가하는 양상을 보인다. total-pushes는 약간 작은 것 같지만, 그래도 1차 함수처럼 보인다. 손으로 약간 정리해보면,
&lt;/p&gt;

&lt;p&gt;
&lt;strong&gt;max-depth = 5n+3&lt;/strong&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;strong&gt;# of pushes = 32n-16&lt;/strong&gt;
&lt;/p&gt;

&lt;p&gt;
로 정리할 수 있다. 이를 가지고 위 표를 채워 넣었다. Recursive factorial 의 경우 공간/시간복잡도 모두 O(n) 이다.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT25 SECTION &quot;Ex 5.27&quot; [5877-7757] --&gt;
&lt;h3 class=&quot;sectionedit27&quot;&gt;&lt;a name=&quot;ex_528&quot; id=&quot;ex_528&quot;&gt;Ex 5.28&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;
Modify the definition of the evaluator by changing eval-sequence as described in section 5.4.2 so that the evaluator is no longer tail-recursive. Rerun your experiments from exercises 5.26 and 5.27 to demonstrate that both versions of the factorial procedure now require space that grows linearly with their input.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT27 SECTION &quot;Ex 5.28&quot; [7758-8091] --&gt;
&lt;h3 class=&quot;sectionedit28&quot;&gt;&lt;a name=&quot;ex_529&quot; id=&quot;ex_529&quot;&gt;Ex 5.29&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;
Monitor the stack operations in the tree-recursive Fibonacci computation:
&lt;/p&gt;

&lt;p&gt;
&lt;pre name=&quot;code&quot; class=&quot;html&quot;&gt;
(define (fib n)
  (if (&amp;lt; n 2)
      n
      (+ (fib (- n 1)) (fib (- n 2)))))
&lt;/pre&gt;
&lt;/p&gt;

&lt;p&gt;
a. Give a formula in terms of &lt;em&gt;n&lt;/em&gt; for the maximum depth of the stack required to compute &lt;em&gt;Fib(n)&lt;/em&gt; for &lt;em&gt;n&lt;/em&gt; &amp;gt;= 2. Hint: In section 1.2.2 we argued that the space used by this process grows linearly with &lt;em&gt;n&lt;/em&gt;.
&lt;/p&gt;

&lt;p&gt;
n의 값을 1부터 12까지 증가시켜가며 print-statistics의 출력을 모아보았다. 역시 첫번째 줄은 함수 정의에서 나온 것으로 두번째 줄부터 시작이다. 
&lt;pre name=&quot;code&quot; class=&quot;html&quot;&gt;
(total-pushes = 3 maximum-depth = 3)
(total-pushes = 16 maximum-depth = 8)
(total-pushes = 72 maximum-depth = 13)
(total-pushes = 128 maximum-depth = 18)
(total-pushes = 240 maximum-depth = 23)
(total-pushes = 408 maximum-depth = 28)
(total-pushes = 688 maximum-depth = 33)
(total-pushes = 1136 maximum-depth = 38)
(total-pushes = 1864 maximum-depth = 43)
(total-pushes = 3040 maximum-depth = 48)
(total-pushes = 4944 maximum-depth = 53)
(total-pushes = 8024 maximum-depth = 58)
(total-pushes = 13008 maximum-depth = 63)
&lt;/pre&gt;
maximum-depth는 손쉽게 5씩 증가하는 1차 함수라는 것을 알 수 있다. 
&lt;/p&gt;

&lt;p&gt;
b. Give a formula for the total number of pushes used to compute &lt;em&gt;Fib(n)&lt;/em&gt; for &lt;em&gt;n&lt;/em&gt; &amp;gt;= 2. You should find that the number of pushes (which correlates well with the time used) grows exponentially with &lt;em&gt;n&lt;/em&gt;. Hint: Let &lt;em&gt;S(n)&lt;/em&gt; be the number of pushes used in computing &lt;em&gt;Fib(n)&lt;/em&gt;. You should be able to argue that there is a formula that expresses &lt;em&gt;S(n)&lt;/em&gt; in terms of &lt;em&gt;S(n - 1), S(n - 2)&lt;/em&gt;, and some fixed ``overhead&amp;#039;&amp;#039; constant &lt;em&gt;k&lt;/em&gt; that is independent of &lt;em&gt;n&lt;/em&gt;. Give the formula, and say what &lt;em&gt;k&lt;/em&gt; is. Then show that &lt;em&gt;S(n)&lt;/em&gt; can be expressed as a &lt;em&gt;Fib(n + 1) + b&lt;/em&gt; and give the values of &lt;em&gt;a&lt;/em&gt; and &lt;em&gt;b&lt;/em&gt;.
&lt;/p&gt;

&lt;p&gt;
힌트에서 주어진대로 fib(n) 을 구하는데 필요한 # of stack pushes 를 S(n) 이라고 하자. fib(n) = fib(n-1) + fib(n-2) 이므로, 당연히 S(n)을 구하는 데에는 S(n-1)과 S(n-2)가 일단 더해지게 된다.
&lt;/p&gt;
&lt;div class=&quot;table sectionedit29&quot;&gt;&lt;table class=&quot;inline&quot;&gt;
	&lt;tr class=&quot;row0&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; n &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; 1 &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; 2 &lt;/td&gt;&lt;td class=&quot;col3&quot;&gt; 3 &lt;/td&gt;&lt;td class=&quot;col4&quot;&gt; 4 &lt;/td&gt;&lt;td class=&quot;col5&quot;&gt; 5 &lt;/td&gt;&lt;td class=&quot;col6&quot;&gt; 6 &lt;/td&gt;&lt;td class=&quot;col7&quot;&gt; 7 &lt;/td&gt;&lt;td class=&quot;col8&quot;&gt; 8 &lt;/td&gt;&lt;td class=&quot;col9&quot;&gt; 9 &lt;/td&gt;&lt;td class=&quot;col10&quot;&gt; 10 &lt;/td&gt;&lt;td class=&quot;col11&quot;&gt; 11 &lt;/td&gt;&lt;td class=&quot;col12&quot;&gt; 12 &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row1&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; S(n) &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; 16 &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; 72 &lt;/td&gt;&lt;td class=&quot;col3&quot;&gt; 128 &lt;/td&gt;&lt;td class=&quot;col4&quot;&gt; 240 &lt;/td&gt;&lt;td class=&quot;col5&quot;&gt; 408 &lt;/td&gt;&lt;td class=&quot;col6&quot;&gt; 688 &lt;/td&gt;&lt;td class=&quot;col7&quot;&gt; 1136 &lt;/td&gt;&lt;td class=&quot;col8&quot;&gt; 1864 &lt;/td&gt;&lt;td class=&quot;col9&quot;&gt; 3040 &lt;/td&gt;&lt;td class=&quot;col10&quot;&gt; 4944 &lt;/td&gt;&lt;td class=&quot;col11&quot;&gt; 8024 &lt;/td&gt;&lt;td class=&quot;col12&quot;&gt; 13008 &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row2&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt; S(n-1)+S(n-2) &lt;/td&gt;&lt;td class=&quot;col1&quot;&gt; &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; &lt;/td&gt;&lt;td class=&quot;col3&quot;&gt; 88 &lt;/td&gt;&lt;td class=&quot;col4&quot;&gt; 200 &lt;/td&gt;&lt;td class=&quot;col5&quot;&gt; 368 &lt;/td&gt;&lt;td class=&quot;col6&quot;&gt; 648 &lt;/td&gt;&lt;td class=&quot;col7&quot;&gt; 1096 &lt;/td&gt;&lt;td class=&quot;col8&quot;&gt; 1824 &lt;/td&gt;&lt;td class=&quot;col9&quot;&gt; 3000 &lt;/td&gt;&lt;td class=&quot;col10&quot;&gt; 4904 &lt;/td&gt;&lt;td class=&quot;col11&quot;&gt; 7984 &lt;/td&gt;&lt;td class=&quot;col12&quot;&gt; 12968 &lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;!-- EDIT29 TABLE [10157-10387] --&gt;
&lt;p&gt;
이 표를 보면, 거의 자명하게
&lt;/p&gt;

&lt;p&gt;
&lt;pre name=&quot;code&quot; class=&quot;html&quot;&gt;
S(1) = 16
S(2) = 72
S(n) = S(n-1) + S(n-2) + 40 if n&amp;gt;=2
&lt;/pre&gt;
&lt;/p&gt;

&lt;p&gt;
라는 점화식을 만들 수 있다. &lt;em&gt;fib(n)&lt;/em&gt; 을 계산하는데 필요한 스택의 push 횟수 역시 피보나치 수를 따라가는 아름다움!
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT28 SECTION &quot;Ex 5.29&quot; [8092-10657] --&gt;
&lt;h3 class=&quot;sectionedit30&quot;&gt;&lt;a name=&quot;ex_530&quot; id=&quot;ex_530&quot;&gt;Ex 5.30&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;
Our evaluator currently catches and signals only two kinds of errors – unknown expression types and unknown procedure types. Other errors will take us out of the evaluator read-eval-print loop. When we run the evaluator using the register-machine simulator, these errors are caught by the underlying Scheme system. This is analogous to the computer crashing when a user program makes an error.&lt;a href=&quot;http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-34.html#call_footnote_Temp_793&quot; class=&quot;urlextern&quot; title=&quot;http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-34.html#call_footnote_Temp_793&quot;  rel=&quot;nofollow&quot;&gt;(footnote)&lt;/a&gt; It is a large project to make a real error system work, but it is well worth the effort to understand what is involved here.
&lt;/p&gt;

&lt;p&gt;
a. Errors that occur in the evaluation process, such as an attempt to access an unbound variable, could be caught by changing the lookup operation to make it return a distinguished condition code, which cannot be a possible value of any user variable. The evaluator can test for this condition code and then do what is necessary to go to signal-error. Find all of the places in the evaluator where such a change is necessary and fix them. &lt;strong&gt;This is lots of work.&lt;/strong&gt;
&lt;/p&gt;

&lt;p&gt;
b. Much worse is the problem of handling errors that are signaled by applying primitive procedures, such as an attempt to divide by zero or an attempt to extract the car of a symbol. In a professionally written high-quality system, each primitive application is checked for safety as part of the primitive. For example, every call to car could first check that the argument is a pair. If the argument is not a pair, the application would return a distinguished condition code to the evaluator, which would then report the failure. We could arrange for this in our register-machine simulator by making each primitive procedure check for applicability and returning an appropriate distinguished condition code on failure. Then the primitive-apply code in the evaluator can check for the condition code and go to signal-error if necessary. Build this structure and make it work. &lt;strong&gt;This is a major project.&lt;/strong&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT30 SECTION &quot;Ex 5.30&quot; [10658-] --&gt;</description>
            <author>dgoon</author>
        <category>sicp</category>
            <pubDate>Tue, 04 Oct 2011 21:07:19 +0900</pubDate>
        </item>
    </channel>
</rss>

