aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2014-04-06 16:40:55 -0500
committerJoel Martin <github@martintribe.org>2014-04-06 16:40:55 -0500
commit31b4416181158b0e49e0a09da8056298b8522ba2 (patch)
tree39ca29f0841823cb8208a93ff59c942466457934
parentb079f51028571bc603b8d43761c29ff56273bffc (diff)
downloadmal-31b4416181158b0e49e0a09da8056298b8522ba2.tar.gz
mal-31b4416181158b0e49e0a09da8056298b8522ba2.zip
JS: fix web interface.
-rw-r--r--.gitmodules3
-rw-r--r--js/core.js4
m---------js/josh.js0
-rw-r--r--js/josh_readline.js24
-rw-r--r--js/node_readline.js3
-rw-r--r--js/printer.js11
-rw-r--r--js/reader.js4
-rw-r--r--js/step0_repl.js9
-rw-r--r--js/step1_read_print.js14
-rw-r--r--js/step2_eval.js14
-rw-r--r--js/step3_env.js16
-rw-r--r--js/step4_if_fn_do.js18
-rw-r--r--js/step5_tco.js20
-rw-r--r--js/step6_file.js20
-rw-r--r--js/step7_quote.js20
-rw-r--r--js/step8_macros.js20
-rw-r--r--js/step9_interop.js20
-rw-r--r--js/stepA_more.js20
-rw-r--r--js/types.js3
-rw-r--r--mal.html4
20 files changed, 149 insertions, 98 deletions
diff --git a/.gitmodules b/.gitmodules
index 247fccb..b260fb9 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,6 @@
[submodule "josh.js"]
path = js/josh.js
url = https://github.com/sdether/josh.js/
+[submodule "js/josh.js"]
+ path = js/josh.js
+ url = https://github.com/sdether/josh.js
diff --git a/js/core.js b/js/core.js
index 48bbe16..b8b0062 100644
--- a/js/core.js
+++ b/js/core.js
@@ -25,13 +25,13 @@ function str() {
}
function prn() {
- printer.print.apply({}, Array.prototype.map.call(arguments,function(exp) {
+ printer.println.apply({}, Array.prototype.map.call(arguments,function(exp) {
return printer._pr_str(exp, true);
}));
}
function println() {
- printer.print.apply({}, Array.prototype.map.call(arguments,function(exp) {
+ printer.println.apply({}, Array.prototype.map.call(arguments,function(exp) {
return printer._pr_str(exp, false);
}));
}
diff --git a/js/josh.js b/js/josh.js
new file mode 160000
+Subproject 257237550ce9c02cfc426918845e636c763c49b
diff --git a/js/josh_readline.js b/js/josh_readline.js
index ff4d201..3d1a3d4 100644
--- a/js/josh_readline.js
+++ b/js/josh_readline.js
@@ -90,6 +90,7 @@ var Josh = Josh || {};
help: _.template("<div><div><strong>Commands:</strong></div><% _.each(commands, function(cmd) { %><div>&nbsp;<%- cmd %></div><% }); %></div>"),
bad_command: _.template('<div><strong>Unrecognized command:&nbsp;</strong><%=cmd%></div>'),
input_cmd: _.template('<div id="<%- id %>"><span class="prompt"></span>&nbsp;<span class="input"><span class="left"/><span class="cursor"/><span class="right"/></span></div>'),
+ empty_input_cmd: _.template('<div id="<%- id %>"></div>'),
input_search: _.template('<div id="<%- id %>">(reverse-i-search)`<span class="searchterm"></span>\':&nbsp;<span class="input"><span class="left"/><span class="cursor"/><span class="right"/></span></div>'),
suggest: _.template("<div><% _.each(suggestions, function(suggestion) { %><div><%- suggestion %></div><% }); %></div>")
},
@@ -168,6 +169,19 @@ var Josh = Josh || {};
_console.log('refreshed ' + _input_id);
},
+ println: function(text) {
+ var lines = text.split(/\n/);
+ for (var i=0; i<lines.length; i++) {
+ var line = lines[i];
+ if (line == "\\n") {
+ continue;
+ }
+ $(id(_input_id)).after(line);
+ $(id(_input_id) + ' .input .cursor').css('textDecoration', '');
+ $(id(_input_id)).removeAttr('id');
+ $(id(_shell_view_id)).append(self.templates.empty_input_cmd({id:_input_id}));
+ }
+ },
scrollToBottom: function() {
_panel.animate({scrollTop: _view.height()}, 0);
},
@@ -394,9 +408,13 @@ readline.rlwrap = function(action) {
action: action});
var promptCounter = 0;
shell.onNewPrompt(function(callback) {
- promptCounter++;
- //callback("[" + promptCounter + "] $");
- callback("user>");
+ promptCounter++;
+ callback("user>");
});
shell.activate();
+
+ // map output/print to josh.js output
+ readline.println = function () {
+ shell.println(Array.prototype.slice.call(arguments).join(" "));
+ };
}
diff --git a/js/node_readline.js b/js/node_readline.js
index bfd1982..f91bbaf 100644
--- a/js/node_readline.js
+++ b/js/node_readline.js
@@ -35,4 +35,5 @@ exports.readline = rlwrap.readline = function(prompt) {
}
return line;
-}
+};
+var readline = exports;
diff --git a/js/printer.js b/js/printer.js
index 0d84cc6..575072e 100644
--- a/js/printer.js
+++ b/js/printer.js
@@ -3,9 +3,14 @@ var printer = {};
if (typeof module !== 'undefined') {
var types = require('./types');
// map output/print to console.log
- var print = exports.print = function () { console.log.apply(console, arguments); };
+ printer.println = exports.println = function () {
+ console.log.apply(console, arguments);
+ };
} else {
var exports = printer;
+ printer.println = function() {
+ readline.println.apply(null, arguments); // josh_readline.js
+ }
}
function _pr_str(obj, print_readably) {
@@ -27,7 +32,9 @@ function _pr_str(obj, print_readably) {
return "{" + ret.join(' ') + "}";
case 'string':
if (print_readably) {
- return '"' + obj.replace(/\\/, "\\\\").replace(/"/g, '\\"') + '"';
+ return '"' + obj.replace(/\\/, "\\\\")
+ .replace(/"/g, '\\"')
+ .replace(/\n/g, "\\n") + '"'; // string
} else {
return obj;
}
diff --git a/js/reader.js b/js/reader.js
index f19010d..3f2f6ca 100644
--- a/js/reader.js
+++ b/js/reader.js
@@ -32,7 +32,9 @@ function read_atom (reader) {
} else if (token.match(/^-?[0-9][0-9.]*$/)) {
return parseFloat(token,10); // float
} else if (token[0] === "\"") {
- return token.slice(1,token.length-1).replace(/\\"/g, '"'); // string
+ return token.slice(1,token.length-1)
+ .replace(/\\"/g, '"')
+ .replace(/\\n/g, "\n"); // string
} else if (token === "nil") {
return null;
} else if (token === "true") {
diff --git a/js/step0_repl.js b/js/step0_repl.js
index 5fa10f2..1d2bbfb 100644
--- a/js/step0_repl.js
+++ b/js/step0_repl.js
@@ -24,7 +24,8 @@ if (typeof require === 'undefined') {
// Asynchronous browser mode
readline.rlwrap(function(line) { return rep(line); },
function(exc) {
- if (exc.stack) { console.log(exc.stack); } else { console.log(exc); }
+ if (exc.stack) { printer.println(exc.stack); }
+ else { printer.println(exc); }
});
} else if (require.main === module) {
// Synchronous node.js commandline mode
@@ -32,9 +33,11 @@ if (typeof require === 'undefined') {
var line = readline.readline("user> ");
if (line === null) { break; }
try {
- if (line) { console.log(rep(line)); }
+ if (line) { printer.println(rep(line)); }
} catch (exc) {
- if (exc.stack) { console.log(exc.stack); } else { console.log(exc); }
+
+ if (exc.stack) { printer.println(exc.stack); }
+ else { printer.println(exc); }
}
}
} else {
diff --git a/js/step1_read_print.js b/js/step1_read_print.js
index 264b6c6..ef9b6bc 100644
--- a/js/step1_read_print.js
+++ b/js/step1_read_print.js
@@ -1,8 +1,8 @@
-var types = require('./types');
-var reader = require('./reader');
-var printer = require('./printer');
if (typeof module !== 'undefined') {
+ var types = require('./types');
var readline = require('./node_readline');
+ var reader = require('./reader');
+ var printer = require('./printer');
}
// read
@@ -29,7 +29,8 @@ if (typeof require === 'undefined') {
readline.rlwrap(function(line) { return rep(line); },
function(exc) {
if (exc instanceof reader.BlankException) { return; }
- if (exc.stack) { console.log(exc.stack); } else { console.log(exc); }
+ if (exc.stack) { printer.println(exc.stack); }
+ else { printer.println(exc); }
});
} else if (require.main === module) {
// Synchronous node.js commandline mode
@@ -37,10 +38,11 @@ if (typeof require === 'undefined') {
var line = readline.readline("user> ");
if (line === null) { break; }
try {
- if (line) { console.log(rep(line)); }
+ if (line) { printer.println(rep(line)); }
} catch (exc) {
if (exc instanceof reader.BlankException) { continue; }
- if (exc.stack) { console.log(exc.stack); } else { console.log(exc); }
+ if (exc.stack) { printer.println(exc.stack); }
+ else { printer.println(exc); }
}
}
} else {
diff --git a/js/step2_eval.js b/js/step2_eval.js
index f5efa2c..f111a58 100644
--- a/js/step2_eval.js
+++ b/js/step2_eval.js
@@ -1,8 +1,8 @@
-var types = require('./types');
-var reader = require('./reader');
-var printer = require('./printer');
if (typeof module !== 'undefined') {
+ var types = require('./types');
var readline = require('./node_readline');
+ var reader = require('./reader');
+ var printer = require('./printer');
}
// read
@@ -65,7 +65,8 @@ if (typeof require === 'undefined') {
readline.rlwrap(function(line) { return rep(line); },
function(exc) {
if (exc instanceof reader.BlankException) { return; }
- if (exc.stack) { console.log(exc.stack); } else { console.log(exc); }
+ if (exc.stack) { printer.println(exc.stack); }
+ else { printer.println(exc); }
});
} else if (require.main === module) {
// Synchronous node.js commandline mode
@@ -73,10 +74,11 @@ if (typeof require === 'undefined') {
var line = readline.readline("user> ");
if (line === null) { break; }
try {
- if (line) { console.log(rep(line)); }
+ if (line) { printer.println(rep(line)); }
} catch (exc) {
if (exc instanceof reader.BlankException) { continue; }
- if (exc.stack) { console.log(exc.stack); } else { console.log(exc); }
+ if (exc.stack) { printer.println(exc.stack); }
+ else { printer.println(exc); }
}
}
} else {
diff --git a/js/step3_env.js b/js/step3_env.js
index 41e21c1..1000437 100644
--- a/js/step3_env.js
+++ b/js/step3_env.js
@@ -1,9 +1,9 @@
-var types = require('./types');
-var reader = require('./reader');
-var printer = require('./printer');
-var Env = require('./env').Env;
if (typeof module !== 'undefined') {
+ var types = require('./types');
var readline = require('./node_readline');
+ var reader = require('./reader');
+ var printer = require('./printer');
+ var Env = require('./env').Env;
}
// read
@@ -80,7 +80,8 @@ if (typeof require === 'undefined') {
readline.rlwrap(function(line) { return rep(line); },
function(exc) {
if (exc instanceof reader.BlankException) { return; }
- if (exc.stack) { console.log(exc.stack); } else { console.log(exc); }
+ if (exc.stack) { printer.println(exc.stack); }
+ else { printer.println(exc); }
});
} else if (require.main === module) {
// Synchronous node.js commandline mode
@@ -88,10 +89,11 @@ if (typeof require === 'undefined') {
var line = readline.readline("user> ");
if (line === null) { break; }
try {
- if (line) { console.log(rep(line)); }
+ if (line) { printer.println(rep(line)); }
} catch (exc) {
if (exc instanceof reader.BlankException) { continue; }
- if (exc.stack) { console.log(exc.stack); } else { console.log(exc); }
+ if (exc.stack) { printer.println(exc.stack); }
+ else { printer.println(exc); }
}
}
} else {
diff --git a/js/step4_if_fn_do.js b/js/step4_if_fn_do.js
index 37803ef..0bf988d 100644
--- a/js/step4_if_fn_do.js
+++ b/js/step4_if_fn_do.js
@@ -1,10 +1,10 @@
-var types = require('./types');
-var reader = require('./reader');
-var printer = require('./printer');
-var Env = require('./env').Env;
-var core = require('./core');
if (typeof module !== 'undefined') {
+ var types = require('./types');
var readline = require('./node_readline');
+ var reader = require('./reader');
+ var printer = require('./printer');
+ var Env = require('./env').Env;
+ var core = require('./core');
}
// read
@@ -96,7 +96,8 @@ if (typeof require === 'undefined') {
readline.rlwrap(function(line) { return rep(line); },
function(exc) {
if (exc instanceof reader.BlankException) { return; }
- if (exc.stack) { console.log(exc.stack); } else { console.log(exc); }
+ if (exc.stack) { printer.println(exc.stack); }
+ else { printer.println(exc); }
});
} else if (require.main === module) {
// Synchronous node.js commandline mode
@@ -104,10 +105,11 @@ if (typeof require === 'undefined') {
var line = readline.readline("user> ");
if (line === null) { break; }
try {
- if (line) { console.log(rep(line)); }
+ if (line) { printer.println(rep(line)); }
} catch (exc) {
if (exc instanceof reader.BlankException) { continue; }
- if (exc.stack) { console.log(exc.stack); } else { console.log(exc); }
+ if (exc.stack) { printer.println(exc.stack); }
+ else { printer.println(exc); }
}
}
} else {
diff --git a/js/step5_tco.js b/js/step5_tco.js
index 2d1793d..d61e243 100644
--- a/js/step5_tco.js
+++ b/js/step5_tco.js
@@ -1,10 +1,10 @@
-var types = require('./types');
-var reader = require('./reader');
-var printer = require('./printer');
-var Env = require('./env').Env;
-var core = require('./core');
if (typeof module !== 'undefined') {
+ var types = require('./types');
var readline = require('./node_readline');
+ var reader = require('./reader');
+ var printer = require('./printer');
+ var Env = require('./env').Env;
+ var core = require('./core');
}
// read
@@ -36,7 +36,7 @@ function eval_ast(ast, env) {
function _EVAL(ast, env) {
while (true) {
- //console.log("EVAL:", types._pr_str(ast, true));
+ //printer.println("EVAL:", types._pr_str(ast, true));
if (!types._list_Q(ast)) {
return eval_ast(ast, env);
}
@@ -106,7 +106,8 @@ if (typeof require === 'undefined') {
readline.rlwrap(function(line) { return rep(line); },
function(exc) {
if (exc instanceof reader.BlankException) { return; }
- if (exc.stack) { console.log(exc.stack); } else { console.log(exc); }
+ if (exc.stack) { printer.println(exc.stack); }
+ else { printer.println(exc); }
});
} else if (require.main === module) {
// Synchronous node.js commandline mode
@@ -114,10 +115,11 @@ if (typeof require === 'undefined') {
var line = readline.readline("user> ");
if (line === null) { break; }
try {
- if (line) { console.log(rep(line)); }
+ if (line) { printer.println(rep(line)); }
} catch (exc) {
if (exc instanceof reader.BlankException) { continue; }
- if (exc.stack) { console.log(exc.stack); } else { console.log(exc); }
+ if (exc.stack) { printer.println(exc.stack); }
+ else { printer.println(exc); }
}
}
} else {
diff --git a/js/step6_file.js b/js/step6_file.js
index df216da..7bbb1b4 100644
--- a/js/step6_file.js
+++ b/js/step6_file.js
@@ -1,10 +1,10 @@
-var types = require('./types');
-var reader = require('./reader');
-var printer = require('./printer');
-var Env = require('./env').Env;
-var core = require('./core');
if (typeof module !== 'undefined') {
+ var types = require('./types');
var readline = require('./node_readline');
+ var reader = require('./reader');
+ var printer = require('./printer');
+ var Env = require('./env').Env;
+ var core = require('./core');
}
// read
@@ -36,7 +36,7 @@ function eval_ast(ast, env) {
function _EVAL(ast, env) {
while (true) {
- //console.log("EVAL:", types._pr_str(ast, true));
+ //printer.println("EVAL:", types._pr_str(ast, true));
if (!types._list_Q(ast)) {
return eval_ast(ast, env);
}
@@ -117,7 +117,8 @@ if (typeof process !== 'undefined' && process.argv.length > 2) {
readline.rlwrap(function(line) { return rep(line); },
function(exc) {
if (exc instanceof reader.BlankException) { return; }
- if (exc.stack) { console.log(exc.stack); } else { console.log(exc); }
+ if (exc.stack) { printer.println(exc.stack); }
+ else { printer.println(exc); }
});
} else if (require.main === module) {
// Synchronous node.js commandline mode
@@ -125,10 +126,11 @@ if (typeof process !== 'undefined' && process.argv.length > 2) {
var line = readline.readline("user> ");
if (line === null) { break; }
try {
- if (line) { console.log(rep(line)); }
+ if (line) { printer.println(rep(line)); }
} catch (exc) {
if (exc instanceof reader.BlankException) { continue; }
- if (exc.stack) { console.log(exc.stack); } else { console.log(exc); }
+ if (exc.stack) { printer.println(exc.stack); }
+ else { printer.println(exc); }
}
}
} else {
diff --git a/js/step7_quote.js b/js/step7_quote.js
index 9721d59..60ae0e8 100644
--- a/js/step7_quote.js
+++ b/js/step7_quote.js
@@ -1,10 +1,10 @@
-var types = require('./types');
-var reader = require('./reader');
-var printer = require('./printer');
-var Env = require('./env').Env;
-var core = require('./core');
if (typeof module !== 'undefined') {
+ var types = require('./types');
var readline = require('./node_readline');
+ var reader = require('./reader');
+ var printer = require('./printer');
+ var Env = require('./env').Env;
+ var core = require('./core');
}
// read
@@ -52,7 +52,7 @@ function eval_ast(ast, env) {
function _EVAL(ast, env) {
while (true) {
- //console.log("EVAL:", types._pr_str(ast, true));
+ //printer.println("EVAL:", types._pr_str(ast, true));
if (!types._list_Q(ast)) {
return eval_ast(ast, env);
}
@@ -137,7 +137,8 @@ if (typeof process !== 'undefined' && process.argv.length > 2) {
readline.rlwrap(function(line) { return rep(line); },
function(exc) {
if (exc instanceof reader.BlankException) { return; }
- if (exc.stack) { console.log(exc.stack); } else { console.log(exc); }
+ if (exc.stack) { printer.println(exc.stack); }
+ else { printer.println(exc); }
});
} else if (require.main === module) {
// Synchronous node.js commandline mode
@@ -145,10 +146,11 @@ if (typeof process !== 'undefined' && process.argv.length > 2) {
var line = readline.readline("user> ");
if (line === null) { break; }
try {
- if (line) { console.log(rep(line)); }
+ if (line) { printer.println(rep(line)); }
} catch (exc) {
if (exc instanceof reader.BlankException) { continue; }
- if (exc.stack) { console.log(exc.stack); } else { console.log(exc); }
+ if (exc.stack) { printer.println(exc.stack); }
+ else { printer.println(exc); }
}
}
} else {
diff --git a/js/step8_macros.js b/js/step8_macros.js
index 3ad3e31..5e39b5b 100644
--- a/js/step8_macros.js
+++ b/js/step8_macros.js
@@ -1,10 +1,10 @@
-var types = require('./types');
-var reader = require('./reader');
-var printer = require('./printer');
-var Env = require('./env').Env;
-var core = require('./core');
if (typeof module !== 'undefined') {
+ var types = require('./types');
var readline = require('./node_readline');
+ var reader = require('./reader');
+ var printer = require('./printer');
+ var Env = require('./env').Env;
+ var core = require('./core');
}
// read
@@ -67,7 +67,7 @@ function eval_ast(ast, env) {
function _EVAL(ast, env) {
while (true) {
- //console.log("EVAL:", types._pr_str(ast, true));
+ //printer.println("EVAL:", types._pr_str(ast, true));
if (!types._list_Q(ast)) {
return eval_ast(ast, env);
}
@@ -161,7 +161,8 @@ if (typeof process !== 'undefined' && process.argv.length > 2) {
readline.rlwrap(function(line) { return rep(line); },
function(exc) {
if (exc instanceof reader.BlankException) { return; }
- if (exc.stack) { console.log(exc.stack); } else { console.log(exc); }
+ if (exc.stack) { printer.println(exc.stack); }
+ else { printer.println(exc); }
});
} else if (require.main === module) {
// Synchronous node.js commandline mode
@@ -169,10 +170,11 @@ if (typeof process !== 'undefined' && process.argv.length > 2) {
var line = readline.readline("user> ");
if (line === null) { break; }
try {
- if (line) { console.log(rep(line)); }
+ if (line) { printer.println(rep(line)); }
} catch (exc) {
if (exc instanceof reader.BlankException) { continue; }
- if (exc.stack) { console.log(exc.stack); } else { console.log(exc); }
+ if (exc.stack) { printer.println(exc.stack); }
+ else { printer.println(exc); }
}
}
} else {
diff --git a/js/step9_interop.js b/js/step9_interop.js
index 3c83e51..8aa8281 100644
--- a/js/step9_interop.js
+++ b/js/step9_interop.js
@@ -1,10 +1,10 @@
-var types = require('./types');
-var reader = require('./reader');
-var printer = require('./printer');
-var Env = require('./env').Env;
-var core = require('./core');
if (typeof module !== 'undefined') {
+ var types = require('./types');
var readline = require('./node_readline');
+ var reader = require('./reader');
+ var printer = require('./printer');
+ var Env = require('./env').Env;
+ var core = require('./core');
}
// read
@@ -67,7 +67,7 @@ function eval_ast(ast, env) {
function _EVAL(ast, env) {
while (true) {
- //console.log("EVAL:", types._pr_str(ast, true));
+ //printer.println("EVAL:", types._pr_str(ast, true));
if (!types._list_Q(ast)) {
return eval_ast(ast, env);
}
@@ -167,7 +167,8 @@ if (typeof process !== 'undefined' && process.argv.length > 2) {
readline.rlwrap(function(line) { return rep(line); },
function(exc) {
if (exc instanceof reader.BlankException) { return; }
- if (exc.stack) { console.log(exc.stack); } else { console.log(exc); }
+ if (exc.stack) { printer.println(exc.stack); }
+ else { printer.println(exc); }
});
} else if (require.main === module) {
// Synchronous node.js commandline mode
@@ -175,10 +176,11 @@ if (typeof process !== 'undefined' && process.argv.length > 2) {
var line = readline.readline("user> ");
if (line === null) { break; }
try {
- if (line) { console.log(rep(line)); }
+ if (line) { printer.println(rep(line)); }
} catch (exc) {
if (exc instanceof reader.BlankException) { continue; }
- if (exc.stack) { console.log(exc.stack); } else { console.log(exc); }
+ if (exc.stack) { printer.println(exc.stack); }
+ else { printer.println(exc); }
}
}
} else {
diff --git a/js/stepA_more.js b/js/stepA_more.js
index a4e1bda..c37668a 100644
--- a/js/stepA_more.js
+++ b/js/stepA_more.js
@@ -1,10 +1,10 @@
-var types = require('./types');
-var reader = require('./reader');
-var printer = require('./printer');
-var Env = require('./env').Env;
-var core = require('./core');
if (typeof module !== 'undefined') {
+ var types = require('./types');
var readline = require('./node_readline');
+ var reader = require('./reader');
+ var printer = require('./printer');
+ var Env = require('./env').Env;
+ var core = require('./core');
}
// read
@@ -67,7 +67,7 @@ function eval_ast(ast, env) {
function _EVAL(ast, env) {
while (true) {
- //console.log("EVAL:", types._pr_str(ast, true));
+ //printer.println("EVAL:", types._pr_str(ast, true));
if (!types._list_Q(ast)) {
return eval_ast(ast, env);
}
@@ -181,7 +181,8 @@ if (typeof process !== 'undefined' && process.argv.length > 2) {
readline.rlwrap(function(line) { return rep(line); },
function(exc) {
if (exc instanceof reader.BlankException) { return; }
- if (exc.stack) { console.log(exc.stack); } else { console.log(exc); }
+ if (exc.stack) { printer.println(exc.stack); }
+ else { printer.println(exc); }
});
} else if (require.main === module) {
// Synchronous node.js commandline mode
@@ -189,10 +190,11 @@ if (typeof process !== 'undefined' && process.argv.length > 2) {
var line = readline.readline("user> ");
if (line === null) { break; }
try {
- if (line) { console.log(rep(line)); }
+ if (line) { printer.println(rep(line)); }
} catch (exc) {
if (exc instanceof reader.BlankException) { continue; }
- if (exc.stack) { console.log(exc.stack); } else { console.log(exc); }
+ if (exc.stack) { printer.println(exc.stack); }
+ else { printer.println(exc); }
}
}
} else {
diff --git a/js/types.js b/js/types.js
index 7fd2962..6d7de0f 100644
--- a/js/types.js
+++ b/js/types.js
@@ -2,9 +2,6 @@
var types = {};
if (typeof module === 'undefined') {
var exports = types;
-} else {
- // map output/print to console.log
- var print = exports.print = function () { console.log.apply(console, arguments); };
}
// General fucnctions
diff --git a/mal.html b/mal.html
index de3a51d..b8b3dd0 100644
--- a/mal.html
+++ b/mal.html
@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
- <title>Building a Lisp</title>
+ <title>Make a Lisp</title>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<link href='http://fonts.googleapis.com/css?family=Source+Code+Pro' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css">
@@ -38,7 +38,7 @@
<div class="wrapper">
<section>
- <h1>Building a Lisp</h1>
+ <h1>Make a Lisp</h1>
<div id="shell-panel">
<div>Lisp REPL</div>