TypeScript icon, indicating that this package has built-in type declarations

1.1.4 • Public • Published

This JavaScript npm package provides all functions and constants that are assumed to be predeclared in the textbook Structure and Interpretation of Computer Programs, JavaScript Edition (SICP JS). This package therefore allows readers of the textbook to run and experiment with all JavaScript programs that appear in the textbook, using Node.js.

Alternatively, you can use the Source Academy, which has all necessary functions and constants predeclared.

Setting up and Using SICP package

You will need node version 16, and yarn.

Create the file package.json first if you have not done that, by running

$ yarn init

Add the following line in the package.json file

  "type": "module"

Install the package sicp as follows:

$ yarn add sicp

To use any functions in the sicp package, you need to import them in your program by writing

import { <Functions here> } from 'sicp';

For example, if your file test.js contains:

import { display, head, list, tail } from 'sicp';

const p = list("I", "love", "sicp");

you can check that everything is in place and then run your program:

% ls
node_modules    package.json    test.js         yarn.lock
% node test.js

The documentation of the functions and constants provided by the sicp package is available here.

This package is generated from the GitHub repository js-slang in the GitHub organization source-academy. Please report issues and bugs in this repository, using the prefix sicp: in the title.


To install a new version of sicp on npm, bump the version number in package.json and then run

% cd ..
% yarn build_sicp_package
% cd sicp_publish
% npm publish

Package Sidebar


npm i sicp

Weekly Downloads






Unpacked Size

1.27 MB

Total Files


Last publish


  • sourceacademy