New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

sicp

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sicp

module to run programs of SICP JS in node.js

latest
npmnpm
Version
1.1.4
Version published
Weekly downloads
59
73.53%
Maintainers
1
Weekly downloads
 
Created
Source

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");
display(head(tail(p)));

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
"love"

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.

Developers

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

Keywords

JavaScript

FAQs

Package last updated on 30 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts