aboutsummaryrefslogtreecommitdiff
path: root/clojure/src
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 /clojure/src
parent7e872ecfc0b00c3675d64b748a5f1e8754c85b7e (diff)
downloadmal-1617910ad342a55762f3ddabb975849d843cff85.tar.gz
mal-1617910ad342a55762f3ddabb975849d843cff85.zip
All: remove slurp-do, use str around slurp instead.
Diffstat (limited to 'clojure/src')
-rw-r--r--clojure/src/step6_file.clj3
-rw-r--r--clojure/src/step7_quote.clj5
-rw-r--r--clojure/src/step8_macros.clj3
-rw-r--r--clojure/src/step9_interop.clj3
-rw-r--r--clojure/src/stepA_more.clj3
5 files changed, 6 insertions, 11 deletions
diff --git a/clojure/src/step6_file.clj b/clojure/src/step6_file.clj
index 80eedef..2eb4e3d 100644
--- a/clojure/src/step6_file.clj
+++ b/clojure/src/step6_file.clj
@@ -90,10 +90,9 @@
(_ref 'read-string reader/read-string)
(_ref 'eval (fn [ast] (EVAL ast repl-env)))
(_ref 'slurp slurp)
-(_ref 'slurp-do (fn [f] (str "(do " (slurp f) ")")))
(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) \")\")))))")
(defn -main [& args]
(if args
diff --git a/clojure/src/step7_quote.clj b/clojure/src/step7_quote.clj
index 8f190dd..398b7d2 100644
--- a/clojure/src/step7_quote.clj
+++ b/clojure/src/step7_quote.clj
@@ -102,7 +102,7 @@
(def repl-env (types/env))
(defn rep
[strng]
- (PRINT (EVAL (READ strng), repl-env)))
+ (PRINT (EVAL (READ strng) repl-env)))
(defn _ref [k,v] (types/env-set repl-env k v))
@@ -113,10 +113,9 @@
(_ref 'read-string reader/read-string)
(_ref 'eval (fn [ast] (EVAL ast repl-env)))
(_ref 'slurp slurp)
-(_ref 'slurp-do (fn [f] (str "(do " (slurp f) ")")))
(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) \")\")))))")
(defn -main [& args]
(if args
diff --git a/clojure/src/step8_macros.clj b/clojure/src/step8_macros.clj
index 8b95ba8..6b696e7 100644
--- a/clojure/src/step8_macros.clj
+++ b/clojure/src/step8_macros.clj
@@ -139,10 +139,9 @@
(_ref 'read-string reader/read-string)
(_ref 'eval (fn [ast] (EVAL ast repl-env)))
(_ref 'slurp slurp)
-(_ref 'slurp-do (fn [f] (str "(do " (slurp f) ")")))
(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) \")\")))))")
(defn -main [& args]
(if args
diff --git a/clojure/src/step9_interop.clj b/clojure/src/step9_interop.clj
index 48ae687..d78aed7 100644
--- a/clojure/src/step9_interop.clj
+++ b/clojure/src/step9_interop.clj
@@ -142,10 +142,9 @@
(_ref 'read-string reader/read-string)
(_ref 'eval (fn [ast] (EVAL ast repl-env)))
(_ref 'slurp slurp)
-(_ref 'slurp-do (fn [f] (str "(do " (slurp f) ")")))
(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) \")\")))))")
(defn -main [& args]
(if args
diff --git a/clojure/src/stepA_more.clj b/clojure/src/stepA_more.clj
index 19a0c36..d5d80bf 100644
--- a/clojure/src/stepA_more.clj
+++ b/clojure/src/stepA_more.clj
@@ -157,12 +157,11 @@
(_ref 'read-string reader/read-string)
(_ref 'eval (fn [ast] (EVAL ast repl-env)))
(_ref 'slurp slurp)
-(_ref 'slurp-do (fn [f] (str "(do " (slurp f) ")")))
(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) \")\")))))")
(defn -main [& args]
(if args