Re: problem with threading and sql lib

2009-09-20 Thread Roger Gilliar
> Nothing leaps out at me as a likely cause of a dropped message. > - The only reason I can think of: It could be a problem when the loading of the JDBC driver is happening inside a thread. At least that would explain why calling (with-connection db nil ) before

Metadata: something funny

2009-09-20 Thread samppi
I was messing with the REPL when I found this happens: Clojure 1.0.0- user=> (def a #^{:a 5} [1 2 3]) #'user/a user=> ^a {:a 5} user=> (def b #^{:b 2} '(1 2 3)) #'user/b user=> ^b {:line 3} user=> (def c (with-meta '(1 2 3) {:c 0})) #'user/c user=> ^c {:c 0} What's going on with that {:line 3}?

Code Walkers for Clojure

2009-09-20 Thread Gorsal
I was just wondering if there was some code walkers for clojure out there, sort of like arnesi for common lisp. In arnesi, it would parse all of the code into objects. A free variable would be a free-variable- reference and a bound variable would be else, and a function form would be an applicatio

Re: Metadata: something funny

2009-09-20 Thread David Nolen
Hmm, I also note that: (def b #^{:b 2} (quote (1 2 3))) ; ^b -> {:line 1} (def b #^{:b 2} (list 1 2 3)) ; ^b -> nil On Sun, Sep 20, 2009 at 12:20 PM, samppi wrote: > > I was messing with the REPL when I found this happens: > > Clojure 1.0.0- > user=> (def a #^{:a 5} [1 2 3]) > #'user/a > user=>

Re: Metadata: something funny

2009-09-20 Thread Wilson MacGyver
I just checked against the latest 1.1 snapshot. It returns the same result as you outlined here. On Sun, Sep 20, 2009 at 12:20 PM, samppi wrote: > > I was messing with the REPL when I found this happens: > > Clojure 1.0.0- > user=> (def a #^{:a 5} [1 2 3]) > #'user/a > user=> ^a > {:a 5} > user=

Re: Metadata: something funny

2009-09-20 Thread Christian Vest Hansen
On Sun, Sep 20, 2009 at 6:20 PM, samppi wrote: > > I was messing with the REPL when I found this happens: > > Clojure 1.0.0- > user=> (def a #^{:a 5} [1 2 3]) > #'user/a > user=> ^a > {:a 5} > user=> (def b #^{:b 2} '(1 2 3)) You have a quote symbol in there, so that line can also be written as:

Re: Metadata: something funny

2009-09-20 Thread Christian Vest Hansen
On Sun, Sep 20, 2009 at 7:25 PM, Christian Vest Hansen wrote: > On Sun, Sep 20, 2009 at 6:20 PM, samppi wrote: >> >> I was messing with the REPL when I found this happens: >> >> Clojure 1.0.0- >> user=> (def a #^{:a 5} [1 2 3]) >> #'user/a >> user=> ^a >> {:a 5} >> user=> (def b #^{:b 2} '(1 2 3

Re: Metadata: something funny

2009-09-20 Thread Jarkko Oranen
> > (def b #^{:b 2} (quote (1 2 3))) > > ... and #^{} applies read-time to the following *form* rather than the > value they evaluate to, so that is why neither (list ...) nor (quote > ...) work. Yep. #^ is for read-time metadata. Note though that the following will work: (def b '#^{:b 2} (1 2 3)

Re: Silly Convention Question

2009-09-20 Thread Daniel Renfer
I think this further reinforces the need for a clj-lint of sorts. I know I have accidentally declared variables, fns, etc. in both def- derivative forms and in let-style forms that have shadowed a var that was in use somewhere else higher up. It would be handy to have a tool I could run ove

Q: How to convert a struct-map to xml and back (ignoring functions)?

2009-09-20 Thread MarkSwanson
I would like to encode/decode Clojure structures to/from a database. Parsing XML is easy, but I can't seem to find a simple way to encode Clojure structures to XML and back. Atm my structures are simple: just simple key/value pairs where the key is always a string and the value is always a string

Re: "If you wish to have a version for off-line use...

2009-09-20 Thread MarkSwanson
Personally, that's not what I want. I want to download the clojure.org web page - one level deep so the files api, special_forms, macros, etc. are all available on my laptop offline. I tried a couple of programs (wget and httrack) to get this but there is some strange combobulation of redirects a

Re: Q: How to convert a struct-map to xml and back (ignoring functions)?

2009-09-20 Thread Timothy Pratley
I've found clojure-contrib/prxml to be very useful http://richhickey.github.com/clojure-contrib/prxml-api.html On Sep 21, 8:32 am, MarkSwanson wrote: > I would like to encode/decode Clojure structures to/from a database. > Parsing XML is easy, but I can't seem to find a simple way to encode >

Re: Metadata: something funny

2009-09-20 Thread samppi
That's perfect. Thanks a lot, everyone. On Sep 20, 11:35 am, Jarkko Oranen wrote: > > > (def b #^{:b 2} (quote (1 2 3))) > > > ... and #^{} applies read-time to the following *form* rather than the > > value they evaluate to, so that is why neither (list ...) nor (quote > > ...) work. > > Yep. #

Re: Can anyone here give a comparison between Clojure and Erlang on concurrent programming?

2009-09-20 Thread dongbo
A million thanks to you guys! To ss: concise and clear. very helpful! To Wojtek: very detailed, I'll bear your suggestion in my mind! Thanks a lot To Timothy: thanks for sharing! -dongbo --~--~-~--~~~---~--~~ You received this message because you are subscribed to

Re: "If you wish to have a version for off-line use...

2009-09-20 Thread Adrian Cuthbertson
Generally I use the source code for clojure and contrib documentation. I open an instance of Jedit on the source directory and use it's search/grep facilities to find what I'm looking for. It also helps in familiarising with the clojure and contrib implementations and learning the techniques used.

exception: agents + swing

2009-09-20 Thread Raoul Duke
hi, i don't have a repro case yet, but i've been trying to use agents to be able to get swing's thread to draw things from my engine w/out having to think hard about threading; using @agent in my swing-related code to get the state of things to be drawn. but sometimes i get an error on a source l

Q: how to solve this concurrency problem ?

2009-09-20 Thread Roger Gilliar
Hi, im not sure how to solve the following problem: (defn parse [outstream-agent xml] (let [content (clojure.xml/parse (ByteArrayInputStream. (. xml getBytes))) first-element (:tag content) ] (try (if @*is-syncing*

Re: Q: how to solve this concurrency problem ?

2009-09-20 Thread Roger Gilliar
Am 21.09.2009 um 06:50 schrieb Roger Gilliar: > > 2.) I modify the code like this: > > (if cache > (cache-message content) > (if (mesage-cache-agent-is-running) > (send-of *message-cache-agent* send-last-message-with > content > ) > --- Thi