aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2014-04-01 23:12:33 -0500
committerJoel Martin <github@martintribe.org>2014-04-01 23:12:33 -0500
commit1617910ad342a55762f3ddabb975849d843cff85 (patch)
tree7d5ec5c3865370fa3cf477b772a79a7b9c6dc109 /js
parent7e872ecfc0b00c3675d64b748a5f1e8754c85b7e (diff)
downloadmal-1617910ad342a55762f3ddabb975849d843cff85.tar.gz
mal-1617910ad342a55762f3ddabb975849d843cff85.zip
All: remove slurp-do, use str around slurp instead.
Diffstat (limited to 'js')
-rw-r--r--js/step6_file.js5
-rw-r--r--js/step7_quote.js5
-rw-r--r--js/step8_macros.js5
-rw-r--r--js/step9_interop.js5
-rw-r--r--js/stepA_more.js5
5 files changed, 5 insertions, 20 deletions
diff --git a/js/step6_file.js b/js/step6_file.js
index b9ec187..6a014eb 100644
--- a/js/step6_file.js
+++ b/js/step6_file.js
@@ -97,13 +97,10 @@ _ref('eval', function(ast) { return EVAL(ast, repl_env); });
_ref('slurp', function(f) {
return require('fs').readFileSync(f, 'utf-8');
});
-_ref('slurp-do', function(f) {
- return '(do ' + require('fs').readFileSync(f, 'utf-8') + ')';
-});
// Defined using the language itself
rep("(def! not (fn* (a) (if a false true)))");
-rep("(def! load-file (fn* (f) (eval (read-string (slurp-do f)))))");
+rep("(def! load-file (fn* (f) (eval (read-string (str \"(do \" (slurp f) \")\")))))");
if (typeof process !== 'undefined' && process.argv.length > 2) {
for (var i=2; i < process.argv.length; i++) {
diff --git a/js/step7_quote.js b/js/step7_quote.js
index 832e47b..6d23595 100644
--- a/js/step7_quote.js
+++ b/js/step7_quote.js
@@ -118,13 +118,10 @@ _ref('eval', function(ast) { return EVAL(ast, repl_env); });
_ref('slurp', function(f) {
return require('fs').readFileSync(f, 'utf-8');
});
-_ref('slurp-do', function(f) {
- return '(do ' + require('fs').readFileSync(f, 'utf-8') + ')';
-});
// Defined using the language itself
rep("(def! not (fn* (a) (if a false true)))");
-rep("(def! load-file (fn* (f) (eval (read-string (slurp-do f)))))");
+rep("(def! load-file (fn* (f) (eval (read-string (str \"(do \" (slurp f) \")\")))))");
if (typeof process !== 'undefined' && process.argv.length > 2) {
for (var i=2; i < process.argv.length; i++) {
diff --git a/js/step8_macros.js b/js/step8_macros.js
index 766f750..65d7a87 100644
--- a/js/step8_macros.js
+++ b/js/step8_macros.js
@@ -142,13 +142,10 @@ _ref('eval', function(ast) { return EVAL(ast, repl_env); });
_ref('slurp', function(f) {
return require('fs').readFileSync(f, 'utf-8');
});
-_ref('slurp-do', function(f) {
- return '(do ' + require('fs').readFileSync(f, 'utf-8') + ')';
-});
// Defined using the language itself
rep("(def! not (fn* (a) (if a false true)))");
-rep("(def! load-file (fn* (f) (eval (read-string (slurp-do f)))))");
+rep("(def! load-file (fn* (f) (eval (read-string (str \"(do \" (slurp f) \")\")))))");
if (typeof process !== 'undefined' && process.argv.length > 2) {
for (var i=2; i < process.argv.length; i++) {
diff --git a/js/step9_interop.js b/js/step9_interop.js
index a811c52..bfc01cb 100644
--- a/js/step9_interop.js
+++ b/js/step9_interop.js
@@ -148,13 +148,10 @@ _ref('eval', function(ast) { return EVAL(ast, repl_env); });
_ref('slurp', function(f) {
return require('fs').readFileSync(f, 'utf-8');
});
-_ref('slurp-do', function(f) {
- return '(do ' + require('fs').readFileSync(f, 'utf-8') + ')';
-});
// Defined using the language itself
rep("(def! not (fn* (a) (if a false true)))");
-rep("(def! load-file (fn* (f) (eval (read-string (slurp-do f)))))");
+rep("(def! load-file (fn* (f) (eval (read-string (str \"(do \" (slurp f) \")\")))))");
if (typeof process !== 'undefined' && process.argv.length > 2) {
for (var i=2; i < process.argv.length; i++) {
diff --git a/js/stepA_more.js b/js/stepA_more.js
index fca3744..2778649 100644
--- a/js/stepA_more.js
+++ b/js/stepA_more.js
@@ -160,15 +160,12 @@ _ref('eval', function(ast) { return EVAL(ast, repl_env); });
_ref('slurp', function(f) {
return require('fs').readFileSync(f, 'utf-8');
});
-_ref('slurp-do', function(f) {
- return '(do ' + require('fs').readFileSync(f, 'utf-8') + ')';
-});
// Defined using the language itself
rep("(def! not (fn* (a) (if a false true)))");
rep("(defmacro! cond (fn* (& xs) (if (> (count xs) 0) (list 'if (first xs) (if (> (count xs) 1) (nth xs 1) (throw \"odd number of forms to cond\")) (cons 'cond (rest (rest xs)))))))");
rep("(defmacro! or (fn* (& xs) (if (empty? xs) nil (if (= 1 (count xs)) (first xs) `(let* (or_FIXME ~(first xs)) (if or_FIXME or_FIXME (or ~@(rest xs))))))))");
-rep("(def! load-file (fn* (f) (eval (read-string (slurp-do f)))))");
+rep("(def! load-file (fn* (f) (eval (read-string (str \"(do \" (slurp f) \")\")))))");
if (typeof process !== 'undefined' && process.argv.length > 2) {
for (var i=2; i < process.argv.length; i++) {