Code Monkey home page Code Monkey logo

isicp's Introduction

Interactive SICP

screenshot

Structure and Interpretation of Computer Programs now in an interactive textbook form!

Click on (almost) any code fragment to edit. Ctrl-Enter will re-run the script.

Contributing

NOTE: a lot of the code lives in a separate repository, web-worker-interpreter

This project is a work-in-progress and we need your help!

  • Report any bugs, typos etc that you find
  • Mark-up more code fragments and exercises! I'm currently in the middle of chapter 2-2
  • Write more exercise autograders!
  • Add new features!

The chapter and section files here will be generated by render_all.sh using files in content/ as input. Please make changes there.

todo

  • Display hints as to why user did not pass an exercise
  • Make code changes persist between page reloads by linking to a google account

Contributing

iSICP is built on the web-worker-interpreter/coding.js library. We use the CodeMirror editor and a custom scheme interpreter.

If you just wish to help port more of SICP to this site, here is how to create an interactive code fragment.

<div id="scheme-times-size">
(* 5 size)
</div>
<script>
prompt("scheme-times-size", ["scheme-define-size"]);
</script>

the div contains the initial text. The second argument to prompt is optional and specifies dependencies.

isicp's People

Contributors

aidenrhall avatar azu avatar colbyr avatar gbezyuk avatar gilch avatar jpeg729 avatar jpjane89 avatar ldct avatar mattjbray avatar mfdj avatar sarabander avatar tuix avatar yuanchenyang avatar zzh8829 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

isicp's Issues

Exercise 1.5 choice text error

The sixth checkbox states:

In normal-order evaluation, (p) is not evaluated because predicate of if evaluates to false

It should state:

In normal-order evaluation, (p) is not evaluated because predicate of if evaluates to true

Stability and speed issues in mobile browsers

1-1-elements.html always crashes in Mobile Safari and Chrome for iOS. This doesn't happen with 1-2-procedures.html.

The codemirror interface is very slow when run in mobile browsers too.

Exercise 1.12 gives out an wrong answer

The quiz is:

Exercise 1.12. The following pattern of numbers is called Pascal's triangle.

The numbers at the edge of the triangle are all 1, and each number inside the triangle is the sum of the two numbers above it.
      1
     1 1
    1 2 1
   1 3 3 1
  1 4 6 4 1
       . . .

Write a procedure that computes elements of Pascal's triangle by means of a recursive process. If a number lies outside of the triangle, return 0 (this makes sense if we view pascal as the combination > > function ). Start counting rows and columns from 0.

I did the Exercise, it gave me an unexpected evaluation,so I try to figure it out why.
End up copying the answer hided in the html, the site evaluates it to be right,
I check in DrRacket with the folowing code.
The answer hided in the site is wrong, #the followings.

; site's answer
(define (pascal row col)
   (cond ( (or (< row col)) 0)
         ((or (= 0 col) (= row col)) 1)
         (else (+ (pascal (- row 1) col)
                  (pascal (- row 1) (- col 1))))))
; the right one
(define (ps row col)
  (cond ((or (< row col)
             (< row 1)
             (< col 1)) 0)
        ((or (= col 1)
             (= col row)) 1)
        (else (+ (ps (- row 1) (- col 1))
                 (ps (- row 1) col)))
  )
)
(define (printPs-iter func row col limit)
  (if (and (= row 1) (= col 1)) (display func))
  (if (< row limit) (display (func row col)))
  (if (= row col) (newline))
  (cond ((> row limit) "end")
        ((> row col) (printPs-iter func row (+ col 1) limit))
        ((= row col) (printPs-iter func (+ row 1) 1 limit)))
  )
(define (printPs func limit)
  (printPs-iter func 1 1 limit)
)
(display "----------------") (newline)
(printPs pascal 5)
(display "----------------") (newline)

(display "----------------") (newline)
(printPs ps 5)
(display "----------------") (newline)

terminal print out:

----------------
#<procedure:pascal>1
21
331
4641

"end"
----------------
----------------
#<procedure:ps>1
11
121
1331

"end"
----------------
> 

Make a contents page tab

A tab is the green thing on the right

The contents page should show all sections as well as exercises

Make a data structure grader

For eg, if the desired answer is '((a b) a b) then we should accept ((a b) a b), (('a 'b) 'a 'b), '(a b) a b ) etc

404 Not Found

<title>404 Not Found</title>

Error: Not Found

The requested URL /isicp/index.html/ was not found on this server.

Tried the ^ <> at the top of the page, but ^ doesn't work. I think it should point to "/isicp/" instead.

Images are broken

They are now situated at http://mitpress.mit.edu/sites/default/files/sicp/full-text/...

I would like to help. How do you want to resolve this? Should I just fix the links or should I download all the images to the images folder to avoid future breakage?

Tell me which solution you prefer and I will make a pull request.

em and tt tags from original text are missing.

Not all of them, but it's pretty spotty. In some places it's been replaced by $ $ for inline equation rendering, but it doesn't seem consistent. I've been looking at the raw html of the original. There are also a lot of name tags for the index. If we're not doing an index, we probably don't need them, but they're probably harmless if we add some with copy/paste. It might have been easier to start from the html version, but we'll lose a lot of work if we try that now.

Exercise 2.5 not working

My code works but is not correctly evaluated. This occurs in other exercises as well.

(define (cons a b)
  (* (expt 2 a)
     (expt 3 b)))

(define (val n i)
  (if (zero? (modulo n i))
      (+ 1 (val (/ n i) i))
      0
  )
)

(define (car p) (val p 2))

(define (cdr p) (val p 3))

Make a code grader

Grader should be allowed to run arbitrary code in order to grade a user-submitted function, instead of simply being able to compare strings.

Section links in footnotes are broken.

The subsections don't even include numbers in this version, so you can't find the reference they're talking about by a text search either. The original book has numbers on the headings and there are many references to them throughout the text, not just the footnotes. These other internal references should also be hypertext to the appropriate chapter and heading.

Equations don't render

image

This is from 1-1-elements.html rendered in Chrome.
Edit: I just noticed a "load unsafe scripts" icon in Chrome. That seems to fix the rendering problem, and it enables the green sidebar which wasn't showing properly before. Is there a way to make the scripts "safe"? Or at least make a note of it so people know they have to enable the scripts manually?

Allow Cmd-Enter evaluation for Mac users

Hey, I'm really digging this project. I noticed I have to run Ctrl-Enter to evaluate code; however, a common convention is to allow Mac users to use Cmd-Enter as well.

I noticed your'e using CodeMirror, and from a previous previous commit that solves #11, you could do something like this:

editor.setOption('extraKeys', {'Cmd-Enter': function() {
  editor.getOption("onBlur")();
}});

Thoughts?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.