Hi,
Consider this file. The * marks the not there \n.
Foo
; Bar*
And slurp and the str call, you get a string which looks like this
"(Foo\n;Bar)". And this gives an error because the closing ) is in the
comment.
Here you see the effect:
user=> (with-open [w (writer "x")] (binding [*out* w] (
== FILE ==
(def x 1)
; my comment
==
(str "'(" (slurp "FILE") ")" )
produces:
==
'((def x 1)
; my comment)
==
oops.
On Thu, Nov 17, 2011 at 05:32, Andres Gomez wrote:
> Thanks for the robustness tip, Meikel.
>
> Just a question, i dont understand what you state, i dont think it
> needs to
Thanks for the robustness tip, Meikel.
Just a question, i dont understand what you state, i dont think it
needs to end in a newline in order to work.
On Nov 16, 5:17 pm, Meikel Brandmeyer wrote:
> Hi,
>
> Am 16.11.2011 um 17:17 schrieb Andres Gomez:
>
> > It is very simple, its most important fu
Hi,
Am 16.11.2011 um 17:17 schrieb Andres Gomez:
> It is very simple, its most important function is: (defn read-file
> [name] (eval (read-string (str "'(" (slurp name) ")"
As a minor nitpick to promote robust code… Please use something like this for
reading:
(let [eof (Object.)] (take-whi
Inspired by Hickey's keynote at the conj, I built a proof of concept
for a program to make non dev builds (remove comments, docstrings,
line breaks)
https://github.com/fractalmedia/prod-build
It is very simple, its most important function is: (defn read-file
[name] (eval (read-string