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
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
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
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
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
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.
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
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
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
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
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.
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
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
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
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
15 matches
Mail list logo