Created
November 21, 2013 23:10
-
-
Save tmcw/7591551 to your computer and use it in GitHub Desktop.
Gist from mistakes.io
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('http://macwright.org/subscript/index.js'); | |
// atoms | |
subscript('@string'); | |
subscript(1); | |
subscript([]); | |
// constants | |
subscript('e'); | |
subscript('pi'); | |
// maths | |
subscript(['+', 1, 1]); | |
subscript(['*', 2, 2]); | |
subscript(['/', 2, 4]); | |
subscript(['floor', 0.2]); | |
// trig | |
subscript(['cos', 0]); | |
subscript(['sin', 0]); | |
// position | |
subscript(['first', 2, 3, 4, 5]); | |
subscript(['rest', 2, 3, 4, 5]); | |
// let | |
subscript(['let', [['x', 42]], 'x']); | |
// lambda | |
subscript([['lambda', ['x'], ['*', 'x', 'x']], [2]]); | |
// if | |
subscript(['if', true, '@foo', '@bar']); | |
subscript(['if', false, '@foo', '@bar']); | |
// comparison operators | |
subscript(['=', 2, 2]); | |
subscript(['>', 2, 2]); | |
subscript(['>=', 2, 2]); | |
subscript(['<=', 2, 2]); | |
subscript(['<', 2, 2]); | |
// functions to javascriptspace | |
fn = subscript(['lambda', ['x'], ['/', 'x', 2]]); | |
fn([8]); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment