(Disclaimer: I post this aware that read-string is considered dangerous for
untrusted code and having starred tools.reader)
I was writing some code using read-string and encountered the following
(somewhat odd?) behavior:
Clojure 1.5.1
user= (read-string 1000N()
1000N
user= (read-string
...@gmail.commailto:nzuc...@gmail.com
Reply-To: Clojure clojure@googlegroups.commailto:clojure@googlegroups.com
Date: Monday, April 29, 2013 16:26
To: Clojure clojure@googlegroups.commailto:clojure@googlegroups.com
Subject: Understanding unmatched parenthesis in read-string
(Disclaimer: I post
Understood, but what I was wondering is why the trailing parenthesis is
discarded / not considered part of the object expression?
On Monday, April 29, 2013 4:32:49 PM UTC-4, Weber, Martin S wrote:
user= (doc read-string)
-
clojure.core/read-string
([s])
Reads
Because 1000N is a complete expression, as you can verify with your REPL.
On Mon, Apr 29, 2013 at 1:43 PM, noahlz nzuc...@gmail.com wrote:
Understood, but what I was wondering is why the trailing parenthesis is
discarded / not considered part of the object expression?
On Monday, April 29,
Ok. The parser reads a single complete expression and discards the rest. It
understands that once it has hit a new character that represents the
beginning of a new expression, it doesn't care.
I suppose I thought the parser would raise an error on detecting an
unmatched parenthesis, but that's
On Mon, Apr 29, 2013 at 1:57 PM, noahlz nzuc...@gmail.com wrote:
Ok. The parser reads a single complete expression and discards the rest.
It understands that once it has hit a new character that represents the
beginning of a new expression, it doesn't care.
I suppose I thought the parser
On Mon, Apr 29, 2013 at 5:02 PM, Ben Wolfson wolf...@gmail.com wrote:
On Mon, Apr 29, 2013 at 1:57 PM, noahlz nzuc...@gmail.com wrote:
Ok. The parser reads a single complete expression and discards the rest.
It understands that once it has hit a new character that represents the
beginning of
On Monday, April 29, 2013 6:07:01 PM UTC-4, Cedric Greevey wrote:
If you want to exhaust read-string's input argument, getting back a vector
of all of the objects in the input and an error if any of them are
syntactically invalid, just call (read-string (str [ in-string ])).
This also
On Mon, Apr 29, 2013 at 3:21 PM, noahlz nzuc...@gmail.com wrote:
I'm guessing vectors are safer than lists for passing to eval?
They're equally unsafe.
--
Ben Wolfson
Human kind has used its intelligence to vary the flavour of drinks, which
may be sweet, aromatic, fermented or spirit-based.