Re: Understanding unmatched parenthesis in read-string

2013-04-29 Thread Ben Wolfson
On Mon, Apr 29, 2013 at 3:21 PM, noahlz 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. ... Family and

Re: Understanding unmatched parenthesis in read-string

2013-04-29 Thread noahlz
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 "]")). > Th

Re: Understanding unmatched parenthesis in read-string

2013-04-29 Thread Cedric Greevey
On Mon, Apr 29, 2013 at 5:02 PM, Ben Wolfson wrote: > On Mon, Apr 29, 2013 at 1:57 PM, noahlz 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

Re: Understanding unmatched parenthesis in read-string

2013-04-29 Thread Ben Wolfson
On Mon, Apr 29, 2013 at 1:57 PM, noahlz 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 would raise an e

Re: Understanding unmatched parenthesis in read-string

2013-04-29 Thread noahlz
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

Re: Understanding unmatched parenthesis in read-string

2013-04-29 Thread Ben Wolfson
Because "1000N" is a complete expression, as you can verify with your REPL. On Mon, Apr 29, 2013 at 1:43 PM, noahlz 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, 2013 4:32

Re: Understanding unmatched parenthesis in read-string

2013-04-29 Thread noahlz
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]) >

Re: Understanding unmatched parenthesis in read-string

2013-04-29 Thread Weber, Martin S
of a paren doesn't matter) Have fun. From: noahlz mailto:nzuc...@gmail.com>> Reply-To: Clojure mailto:clojure@googlegroups.com>> Date: Monday, April 29, 2013 16:26 To: Clojure mailto:clojure@googlegroups.com>> Subject: Understanding unmatched parenthesis in read-string (Disc

Understanding unmatched parenthesis in read-string

2013-04-29 Thread noahlz
(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 "10