Re: Tagged literals: undefined tags blow up reader

2012-09-19 Thread Steve Miner
I added the following comment to CLJ-927 as a possible solution. It would be convenient if I could handle unknown tags using some sort of catch-all key in data-readers (say 'default). The associated function should take two arguments: the tag and the literal value. If there is no 'default key

Re: Tagged literals: undefined tags blow up reader

2012-09-18 Thread kovas boguta
So the edn spec gives the following guidelines: "If a reader encounters a tag for which no handler is registered, the implementation can either report an error, call a designated 'unknown element' handler, or create a well-known generic representation that contains both the tag and the tagged eleme

Re: Tagged literals: undefined tags blow up reader

2012-07-16 Thread Stuart Sierra
Hi Kovas, I considered the problem of what to do with undefined tags when I implemented this, but I didn't have a clear idea of what the result type should be, so I ignored it. I also didn't know what to do with the metadata. For example, on the JVM, you can't put metadata on Java types like S

Re: Tagged literals: undefined tags blow up reader

2012-07-16 Thread kovas boguta
The special but important case of compiling clojurescript also raises some issues. When clojurescript source code is read, this is done by clojure, and thus the clojure tag readers apply. Currently they are re-bound to read the tag literals into clojurescript source code which, when executed, crea

Re: Tagged literals: undefined tags blow up reader

2012-07-16 Thread kovas boguta
Bumping this thread, since this is becoming more of a blocker for my efforts with Session. I think there are three operations you want to do on the unknown literal wrapper: 1. print/serialize it (this would just output the original string you read in) 2. get the tag name 3. get the uninterpreted d

Re: Tagged literals: undefined tags blow up reader

2012-04-28 Thread Steve Miner
Fogus filed a bug about this a while back: http://dev.clojure.org/jira/browse/CLJ-927 My suggestion is that an unknown tag should be read as a map with a couple of well-defined keys (such as :unknown-literal and :value) so that the program has a way to support data that it doesn't understand.

Re: Tagged literals: undefined tags blow up reader

2012-04-28 Thread Stuart Sierra
Yes, I've been considering this. Unknown tags could return some kind of "tagged object" that has the tag in its metadata. I don't know is what the interface to that object should be. -S -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to thi

Tagged literals: undefined tags blow up reader

2012-04-27 Thread kovas boguta
Thanks everyone involved for the 1.4 release. One issue: In 1.4, tagged literals need to be defined, otherwise the reader blows up: user=> [:a #foo/bar :b] RuntimeException No reader function for tag foo/bar clojure.lang.LispReader$CtorReader.readTagged (LispReader.java:1164) RuntimeException Unm

Re: Monad problem: rewriting a recursive domonad call to not blow up the stack

2010-05-04 Thread Konrad Hinsen
On 04.05.2010, at 05:39, David Barksdale wrote: > I tried to define "n-times" using the pattern of none-or-more and came > to the realization that the state-m-until does not handle a parser > that fails. So here is m-until for the parser monad and my n-times > using it: That looks like a good app

Re: Monad problem: rewriting a recursive domonad call to not blow up the stack

2010-05-03 Thread David Barksdale
On May 2, 10:59 pm, David Barksdale wrote: > On Dec 28 2009, 7:03 am, Konrad Hinsen > wrote: > > > > > On 27.12.2009, at 01:47, samppi wrote: > > > > creates a new rule that repeats a given subrule. The problem with rep+ > > > right now is that it increases the stack for every token it consumes

Re: Monad problem: rewriting a recursive domonad call to not blow up the stack

2010-05-03 Thread David Barksdale
On Dec 28 2009, 7:03 am, Konrad Hinsen wrote: > On 27.12.2009, at 01:47, samppi wrote: > > > creates a new rule that repeats a given subrule. The problem with rep+ > > right now is that it increases the stack for every token it consumes, > > which overflows the stack with large amounts of tokens.

Re: Monad problem: rewriting a recursive domonad call to not blow up the stack

2009-12-28 Thread Konrad Hinsen
On 27.12.2009, at 01:47, samppi wrote: > creates a new rule that repeats a given subrule. The problem with rep+ > right now is that it increases the stack for every token it consumes, > which overflows the stack with large amounts of tokens. > > Is there, then, a way to rewrite rep+ so that it doe

Monad problem: rewriting a recursive domonad call to not blow up the stack

2009-12-26 Thread samppi
For those of you who are familiar with Clojure monads, please consider the following problem. In the REPL log below, I define a monad parser- m whose monadic values are parser functions (in fact, it's the same as state-m, only with nil indicating failure) and a function rep+ that creates a new rule

Re: Blow up

2009-03-28 Thread William D. Lipe
Your analysis is correct. Note that adding a doall fixes the problem user=> (def tl (reduce #(doall (concat %1 [%2])) [] (range 4000))) #'user/tl user=> (last tl) 3999 efficiency notwithstanding. On Mar 28, 8:59 am, jim wrote: > Hey Rich, > > I found an interesting way

Blow up

2009-03-28 Thread jim
Hey Rich, I found an interesting way to blow up the stack. user=> (def tl (reduce #(concat %1 [%2]) [] (range 3500))) #'user/tl user=> (last tl) java.lang.StackOverflowError (NO_SOURCE_FILE:0) The 3500 is probably specific to my environment. I'm assuming that all the conc