From 2dfe777d0fdccb7058797ff658741eb8bb2f5edc Mon Sep 17 00:00:00 2001 From: Nicolas Boulenguez Date: Fri, 31 May 2019 14:33:17 +0200 Subject: [PATCH] mal: modify lib/ in order to hide bugs in make/ and guile/ Make: avoid # character. Guile: avoid `unquote` inside a vector inside a list inside `quasiquote`. The bug in scheme/ is most probably the same. --- lib/perf.mal | 4 ++-- lib/test_cascade.mal | 2 +- lib/trivial.mal | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/perf.mal b/lib/perf.mal index a88b3413e7..0025fee93e 100644 --- a/lib/perf.mal +++ b/lib/perf.mal @@ -7,8 +7,8 @@ (fn* (exp) (let* [start (gensym) ret (gensym)] - `(let* [~start (time-ms) - ~ret ~exp] + `(let* (~start (time-ms) + ~ret ~exp) (do (prn (str "Elapsed time: " (- (time-ms) ~start) " msecs")) ~ret))))) diff --git a/lib/test_cascade.mal b/lib/test_cascade.mal index 0e85a60f9e..6494c1f59b 100644 --- a/lib/test_cascade.mal +++ b/lib/test_cascade.mal @@ -16,7 +16,7 @@ (if (< (count xs) 2) (first xs) (let* [r (gensym)] - `(let* [~r ~(first xs)] (if ~r ~r (or ~@(rest xs)))))))) + `(let* (~r ~(first xs)) (if ~r ~r (or ~@(rest xs)))))))) ;; Conjonction of predicate values (pred x1) and .. and (pred xn) ;; Evaluate `pred x` for each `x` in turn. Return `false` if a result diff --git a/lib/trivial.mal b/lib/trivial.mal index 8ae32020c4..209693fdb0 100644 --- a/lib/trivial.mal +++ b/lib/trivial.mal @@ -12,8 +12,8 @@ ;; Returns the unchanged argument. (def! identity (fn* (x) x)) -;; Generate a hopefully unique symbol. -;; http://www.gigamonkeys.com/book/macros-defining-your-own.html#plugging-the-leaks +;; Generate a hopefully unique symbol. See section "Plugging the Leaks" +;; of http://www.gigamonkeys.com/book/macros-defining-your-own.html (def! gensym (let* [counter (atom 0)] (fn* []