github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

jamie / sicp

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 1
    • 0
  • Source
  • Commits
  • Network (0)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

SICP Exercises — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

implement remaining sec 1.1 instructors exercises 
Jamie Macey (author)
Thu Jan 22 11:11:14 -0800 2009
commit  d0074a212f3074cc2c6c1595fb0149fab6fc65a7
tree    b16eb42b2de6c0f1e47de0a0a220b4353ef57a58
parent  f33227bc70149ef041473d44a2441f0614741827
sicp /
name age
history
message
directory 1.1.3/ Loading commit data...
directory 1.1.6/
directory 1.1.7/
directory 1.1.8/
file clojure.jar
file readme.md
file repl
readme.md

SICP Exercises

Root directories are the section in the text, filenames are exercise number. Plain text responses in .txt files, scheme source in .ss files (tested with PLT Scheme), clojure source in .clj files (tested with Clojure v20081217).

Also included are exerciese from the Instructor's Manual, prefixed with an 'M'.

Support Files

I've included clojure.jar, v20081217, and a simple wrapper bash script that will open up the Clojure REPL.

Notes

There are some special form differences between the scheme presented in SICP and Clojure. I'm documenting them here as I go along.

Scheme                                Clojure

(define a 3)                          (def a 3)

(cond ((= a 4) 6)                     (cond (= a 4) 6
      ((= b 4) (+ 6 7 a))                   (= b 4) (+ 6 7 a)
      (else 25))                            :else 25)

(define (a-plus-abs-b a b)            (defn a-plus-abs-b [a b]
  ((if (> b 0) + -) a b))               ((if (> b 0) + -) a b))

                                      ; The JVM doesn't automatically support
                                      ; tail-call optimization, so Clojure
                                      ; provides a keyword to hint it
(defn sqrt-iter [guess x]             (defn sqrt-iter [guess x]
  (if (good-enough? guess x)            (if (good-enough? guess x)
      guess                                 guess
      (sqrt-iter (improve guess x)          (recur (improve guess x)
                 x)))                              x)))             
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server