GithubHelp home page GithubHelp logo

source-academy / sicp Goto Github PK

View Code? Open in Web Editor NEW
891.0 891.0 115.0 227.46 MB

XML sources of SICP and SICP JS, and support for generating Interactive SICP JS, PDF, e-book and comparison editions

Home Page: https://sourceacademy.org/sicpjs

License: Creative Commons Attribution Share Alike 4.0 International

Makefile 0.45% CSS 19.32% JavaScript 71.85% HTML 0.22% TeX 7.91% Shell 0.25% Perl 0.01%
hacktoberfest javascript javascript-adaptation latex sicp sicp-js source-academy textbook

sicp's People

Contributors

angelsl avatar benclmnt avatar clean99 avatar dependabot[bot] avatar devinryu avatar dralastaircurrie avatar eksinyue avatar gerhean avatar j-fer avatar jiachen247 avatar jiayushe avatar jolynnn8d avatar jonchan51 avatar joypp avatar martin-henz avatar meowzz95 avatar ngxingyu avatar ning-y avatar peironggg avatar qreoct avatar raivatshah avatar reki-code avatar rye-catcher avatar samuelfangjw avatar tcgj avatar tfritzon avatar theodoreleebrant avatar tobiaswrigstad avatar vpatryshev avatar yiwen101 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

sicp's Issues

Exercise 1.17

Exercise 1.17 should have the alternative statement as a + times(a, b - 1) right? Since, the question states we assume there is no * operator in the language for this question:

1.3.2: fix arrows

x => x + 4
↑ ↑ ↑ ↑ ↑
// the function with argument x that results in the value plus 4

Put the arrows like ^ inside of the program, as in a previous snippet

PDF: SCHEMEINLINE ignored

In the XML, the tag SCHEMEINLINE is used as synonym for JAVASCRIPTINLINE.

Currently, the tag SCHEMEINLINE seems to be ignored. Can we treat it exactly like JAVASCRIPTINLINE?

PDF: white space between SPLITINLINE currently ignored

The XML in section 1.2.6

            The 
            <SPLITINLINE>
              <SCHEME>
                <SCHEMEINLINE>smallest-divisor</SCHEMEINLINE> 
              </SCHEME>
              <JAVASCRIPT>
                <JAVASCRIPTINLINE>smallest_divisor</JAVASCRIPTINLINE> 
              </JAVASCRIPT>
            </SPLITINLINE>
            <SPLITINLINE><SCHEME>procedure</SCHEME><JAVASCRIPT>function</JAVASCRIPT></SPLITINLINE> 
            shown

is currently rendered as follows:

Screenshot 2019-06-05 at 4 44 30 PM

There is no space between smallest_divisor and "shown", although there is a newline between the two occurrences of SPLITINLINE.

Web: use SVG whenever available

Not sure if it's worth playing with tools like Inkscape to include SVG files in the LaTeX sources. Perhaps we should convert them to PNG, to keep the whole system simple.

Any views appreciated.

All: Proposal on image sizing and styling

Issue

Figures 3.29 and 3.30 in Chapter 3.4.1 The Nature of Time in Concurrent Systems are really huge. Once Chapter 3.4.1 is loaded to the screen, these figures require excessive horizontal scrolling. Even when fully zoomed out and on full screen, figure 3.29 still does not fit on screen and figure 3.30 barely fits.

Screenshots

These screenshots show fully zoomed-out browsers.
Firefox:

Chrome:

Browser versions

Mozilla Firefox 67.0.4
Google Chrome 75.0.3770

Chapters 1 and 2: Undefined functions in Source Academy

There are some functions in the textbook undefined in Source Academy platform:
Chapter1:

  1. In 1.1.8, function math_log, math_exp undefined;
  2. In 1.2.6, a) function math_random, math_floor undefined;
    b) Library Math undefined;
  3. In 1.3.3, function math_sin, math_cos undefined;

Chapter2:

  1. In 2.2.4, function make_painter_from_url undefined;
  2. In 2.3.3, a) In first is_element_set program, function is_equal undefined;
    b) In Exercise 2.62, function quotient undefined;
    c) In look_up program, function is_equal and key undefined
  3. In 2.3.4, function symbol_leaf undefined;
  4. In 2.4.3, function get undefined;
  5. In 2.5.2, function put, put_coercion, get_coercion undefined;

PDF: special characters not working

For example

Screenshot 2019-06-05 at 3 37 20 PM

should be

Lamé's Theorem

The full list of special characters is in

sicp/rails/app/controllers/chapters_controller.rb:

        replace_tag(xml_doc, 'APOS', '\'')
        replace_tag(xml_doc, 'SPACE', ' ')
        replace_tag(xml_doc, 'WJ', '&#8288;')
        replace_tag(xml_doc, 'AACUTE_LOWER', '&aacute;')
        replace_tag(xml_doc, 'AACUTE_UPPER', '&Aacute;')
        replace_tag(xml_doc, 'AGRAVE_LOWER', '&agrave;')
        replace_tag(xml_doc, 'AGRAVE_UPPER', '&Agrave;')
        replace_tag(xml_doc, 'ACIRC_LOWER', '&acirc;')
        replace_tag(xml_doc, 'EACUTE_LOWER', '&eacute;')
        replace_tag(xml_doc, 'EACUTE_UPPER', '&Eacute;')
        replace_tag(xml_doc, 'EGRAVE_LOWER', '&egrave;')
        replace_tag(xml_doc, 'EGRAVE_UPPER', '&Egrave;')
        replace_tag(xml_doc, 'ECIRC_LOWER', '&ecirc;')
        replace_tag(xml_doc, 'OUML_LOWER', '&ouml;')
        replace_tag(xml_doc, 'OUML_UPPER', '&Ouml;')
        replace_tag(xml_doc, 'UUML_LOWER', '&uuml;')
        replace_tag(xml_doc, 'UUML_UPPER', '&Uuml;')
        replace_tag(xml_doc, 'CCEDIL_LOWER', '&ccedil;')
        replace_tag(xml_doc, 'ELLIPSIS', '&#8230;')
        replace_tag(xml_doc, 'AMP', '&amp;')
        replace_tag(xml_doc, 'SECT', '&sect;')
        replace_tag(xml_doc, 'EMDASH', '&mdash;')
        replace_tag(xml_doc, 'ENDASH', '&ndash;')

1.2.1 program -> state

That para should say "state names" instead of "program names". This is a mistake already in the original textbook.

PDF: Formatting of exercises

Exercises are currently formatted like this:

Screenshot 2019-06-04 at 9 30 41 PM

A couple of suggestions:

(1) Spacing

In the original textbook, exercises look like this:

Screenshot 2019-06-04 at 9 30 25 PM copy 2

I think this spacing is nicer: "Exercise" flushed left and no vertical space between "Exercise" and the text.

(2) Link to solution

I find the text "Link to solution" at the top a bit clumsy. How about just letting the users click on "Exercise 1.7" instead?

Screenshot 2019-06-04 at 9 30 25 PM copy

Would that be too obscure?

Alternatively, we could provide a link at the bottom:

Screenshot 2019-06-04 at 9 30 25 PM copy 2

PDF: size of images

We need to find a way to have reasonable sizes for the images. Do they have a "natural" size that we can use for all versions of the textbook?

Currently, the PDF version stretches images to fill the entire width of the text:

Screenshot 2019-06-05 at 2 18 28 PM

Chapter 3: function defined error in textbook

In chapter 3.5.2, add_stream function is defined as follows:

function add_streams(s1, s2) {
    return stream_map(function(x, y) { return x + y;},  s1, s2);
}

however, in chapter 3.5.1, steam_map takes 2 arguments only.

function stream_map(f, s) {
    if (is_empty_list(s)) {
        return [];
    } else {
        return pair(f(head(s)),
                    function() {
                        return stream_map(f, stream_tail(s));
                    });
    } 
}

Exercise 1.2.4

Add comma: More precisely, the number of multiplications required is equal to 1 less than the log base 2 of n**,** plus the number of ones in the binary representation of n.

Exercise 1.15

Shouldn't the answer for Exercise 1.15 question 2 be in terms of a and not n, i.e. it should be O(log3(a))?
The ans says it is O(log3(n)) for both time and space

PDF: ordered lists <OL> in exercises

Ordered lists <OL> in exercises should lead to a display as follows:

a. Here is the first part.
b. And here is the second part.

Currently, the list is numbered numerically:

1. Here is the first part.
2. And here is the second part.

PDF: <INDEX> not working for names

We should allow a mechanism to include names in the index. One way could be:
<INDEX>flatmap@<JAVASCRIPTINLINE>flatmap</JAVASCRIPTINLINE></INDEX>
Similarly, subindices could include names:
<INDEX>half-interval method<SUBINDEX>half@<JAVASCRIPTINLINE>half_interval_method</JAVASCRIPTINLINE></SUBINDEX></INDEX>
Neither of these currently work. I'm open to a different format or HTML tag for including names in the index and subindices.

Invalid parameter for chapter in playground links

There is a change in specification for shared playground links, in the new version of source-academy at cadet-frontend.

Shared playground links must take the form,

{host}/playground#chap={chap}&ext={ext}&prgrm={lzStr}

Where

  • {host} is the host of source-academy, e.g. http://stg-cadet-frontend.s3-website-ap-southeast-1.amazonaws.com for the staging server, or https://http://sourceacademy.nus.edu.sg for deployment. Required.
  • {chap} is an integer representing the source chapter version. e.g. 1 for Source §1, 2 for Source §2, ... Optional, defaults to the latest chapter if missing or invalid.
  • {ext} is a string representing the name of the external library to be used. The list of permitted external library names are here. For example, one can specify CURVES to allow usage of the curves library in the playground upon loading the program, ... Optional, defaults to "NONE" if missing or invalid.
  • {prgrm} is a string representing the hashed program in the editor. Alternatively, the key for this parameter can also be lz, i.e. &lz={lzStr}, for back-compatibility. Required.

The order of the parameters after the hash (#) does not matter.

Examples of Valid URLs

http://stg-cadet-frontend.s3-website-ap-southeast-1.amazonaws.com/playground#chap=2&prgrm=EQQ2G4g
http://stg-cadet-frontend.s3-website-ap-southeast-1.amazonaws.com/playground#chap=2&lz=EQQ2G4g

http://stg-cadet-frontend.s3-website-ap-southeast-1.amazonaws.com/playground#chap=1&prgrm=EQQ2G4g
http://stg-cadet-frontend.s3-website-ap-southeast-1.amazonaws.com/playground#chap=2&prgrm=EQQ2G4g
http://stg-cadet-frontend.s3-website-ap-southeast-1.amazonaws.com/playground#prgrm=EQQ2G4g

http://stg-cadet-frontend.s3-website-ap-southeast-1.amazonaws.com/playground#chap=2&ext=TWO_DIM_RUNES&prgrm=EQQ2G4g
http://stg-cadet-frontend.s3-website-ap-southeast-1.amazonaws.com/playground#ext=THREE_DIM_RUNES&prgrm=EQQ2G4g

Suggestions

We use the lz-string javascript library to hash the programs into the prgrm/lz parameter value. It is probably possible to dynamically generate and parse an example program in the textbook into this hashed string, then interpolate it as a valid URL, saving a bunch of manual work (if this is not already implemented).

PDF: em dashes missing

The tag <EMDASH/> is apparently not implemented. It should lead to an em dash. In LaTeX, an em dash is produced with three hyphens: ---

Example:

Screenshot 2019-06-04 at 5 24 31 PM

PDF: <SPACE/> should become ~

In typesetting, it is considered bad style to have a newline between parts that are intimately related. For example, in the sentence "The distance was 11 km as the crow flies.", there should be no newline between "11" and "km". Here is an example of this in the PDF:

Screenshot 2019-06-07 at 10 20 28 AM

There should be no newline between "section" and "1.2.1". In the XML sources, we use the tag <SPACE/> to indicate a non-breaking space:
in section<SPACE/><REF NAME="sec:recursion-and-iteration"/> the number

In LaTeX, the symbol ~ allows to place a space between two parts of a sentence, while making sure that they are never separated by a newline. So instead of
described in section \ref{sec:recursion-and-iteration} the number
we should write:
described in section~\ref{sec:recursion-and-iteration} the number
To make the long story short: We should translate <SPACE/> to ~ in LaTeX.

Web: Footnotes are not linked properly

If there are multiple footnotes with the same number on the screen, the clicking of a footnote leads to the first footnote with that number, not necessarily the correct one.

PDF: clickable programs?

Can we turn programs in the PDF version into clickable links, similar to programs in the web version?

Web: Scrolling order inconsistent with table of contents for 'Acknowledgements'

Issue

When scrolling down the Acknowledgements section, it jumps straight to the References section.

Expected behaviour

In the table of contents, Acknowledgements is followed by Chapter 1. As a user, this makes me expect to be led to Chapter 1 as I finish the Acknowledgements section, instead of being led to the References section.

Additional remarks

I am not sure if this is an intended behaviour. The link to Acknowledgements is suffixed with /87 (https://sicp.comp.nus.edu.sg/chapters/87), while References is suffixed with /88. With respect to this, the behaviour is not surprising. However, it could be confusing to users because of the inconsistency with the table of contents.

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.