Re: Macro tutorials?

2011-10-06 Thread Stefan Kamphausen
Hi. You might consider reading Peter Seibel's excellent Practical Common Lisp which has some nice macro-work in it. If after that you're still hungry for more, consider Let Over Lambda by Doug Hoyte. Admitted, both cover Common Lisp, but the differences will not keep you from getting a

Re: Reuse of generic Clojure/ClojureScript code?

2011-10-06 Thread Laurent PETIT
Hmm, I think the maven convention will start to make sense, somehow : src/main/java/ - src/main/java/ src/main/clojure/ ; clojure only code (jvm that is) src/main/clojurescript/ ; clojurescript only code src/main/clojurescript/ ; shared by clojure or clojurescript : no bounty, but better name

Re: goog.net.cookies with clojurescript?

2011-10-06 Thread Jonathan Fischer Friberg
I managed to do it. The problem is that we need to use the function set in a goog.net.Cookies object. There is already such an object, which is called goog.net.cookies, see the bottom of the source file: /** * A static default instance. * @type {goog.net.Cookies} */ goog.net.cookies = new

Re: Macro tutorials?

2011-10-06 Thread Michael Jaaka
Thanks to all! You have helped a lot! Also I will consider reading Practical Common Lisp. On Oct 6, 9:42 am, Stefan Kamphausen ska2...@googlemail.com wrote: Hi. You might consider reading Peter Seibel's excellent Practical Common Lisp which has some nice macro-work in it. If after that you're

clojure.contrib.base64

2011-10-06 Thread Rok Lenarcic
I use Base64 encoding a lot and the slow implementation is hurting a lot. It's slower than Sun misc encoder/decoder and that one is very very slow. I was using Sun's implementation a bit and it took 80 seconds to encode a 56 MB file. Then I found this: http://migbase64.sourceforge.net/ It loaded

Re: Exception handling changes in Clojure 1.3.0

2011-10-06 Thread Rok Lenarcic
On Oct 3, 9:27 pm, Stuart Halloway stuart.hallo...@gmail.com wrote: Catching checked exceptions seems to work fine. Try e.g. (try (throw (java.io.IOException.)) (catch java.io.IOException _ caught!)) I suspect something else is going wrong in the GAE example. Can you narrow the code down

Re: Exception handling changes in Clojure 1.3.0

2011-10-06 Thread Meikel Brandmeyer (kotarak)
It does. user= (defn f [] (Class/forName nonexistant)) #'user/f user= (try (f) (catch ClassNotFoundException e caught!)) caught! -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that

Re: clojure.contrib.base64

2011-10-06 Thread Jonathan Fischer Friberg
thus enable all Clojure developers to have lightning fast Base64 encoding/decoding? This is already possible, if you're using leiningen: put the file in src/util/ and compile, you can now call it as usual. On Thu, Oct 6, 2011 at 11:16 AM, Rok Lenarcic rok.lenar...@gmail.comwrote: I use

Re: clojure.contrib.base64

2011-10-06 Thread Meikel Brandmeyer (kotarak)
Hi, may I ask an heretic question? When there is a fast migbase64... why not just use that one? It was always promoted to use existing Java libraries where it made sense. Or is clojurescript now changing this stance? Sincerely Meikel -- You received this message because you are subscribed

Re: clojure.contrib.base64

2011-10-06 Thread Stuart Halloway
I use Base64 encoding a lot and the slow implementation is hurting a lot. It's slower than Sun misc encoder/decoder and that one is very very slow. I was using Sun's implementation a bit and it took 80 seconds to encode a 56 MB file. Then I found this: http://migbase64.sourceforge.net/ It

Re: clojure.contrib.base64

2011-10-06 Thread Chas Emerick
On Oct 6, 2011, at 4:44 AM, Jonathan Fischer Friberg wrote: thus enable all Clojure developers to have lightning fast Base64 encoding/decoding? This is already possible, if you're using leiningen: put the file in src/util/ and compile, you can now call it as usual. I've used the sun.misc

Re: goog.net.cookies with clojurescript?

2011-10-06 Thread Eric Harris-Braun
Thanks Jonathan! That's it exactly. I had seen goog.net.cookies (lowercase) and didn't realize it was an object on which to make the set call. I thought in was another namespace in which to make the function call, thus I had been writing: .. (:use [goog.net.cookies :as cookie]) ... and was

Re: clojure.contrib.base64

2011-10-06 Thread Aaron Bedra
This actually introduces an opportunity for a much larger set of utilities. clojure.data.crypto base64 is part of this idea anyways, and putting it in place along with nice wrappers around the messy java crypto bits I think could provide a significant win. I have had to do this several times

how to use record as a value

2011-10-06 Thread Razvan Rotaru
Hi, I want to instantiate a record, but having the record type as value at runtime. Example: (defrecord car [year manufacturere]) (defrecord bike [year manufacturere]) (defrecord boat [year manufacturer]) I want to do (new stuff 1982 Mercedes), but having the record type kept in the variable

Re: how to use record as a value

2011-10-06 Thread Aaron Bedra
Assuming you want to do things with the record later, why not just create it in the let binding (let [foo (-car 1982 Mercedes)] ...) or (let [foo (car. 1982 Mercedes)] ...) or even (let [foo (map-car {:year 1982 :manufacturer Mercedes})] ...) or if you must (let [foo #user.car{:year

Re: how to use record as a value

2011-10-06 Thread Bronsa
is it -record just a shortrand for record.? 2011/10/6 Aaron Bedra aaron.be...@gmail.com Assuming you want to do things with the record later, why not just create it in the let binding (let [foo (-car 1982 Mercedes)] ...) or (let [foo (car. 1982 Mercedes)] ...) or even (let [foo

Re: how to use record as a value

2011-10-06 Thread Razvan Rotaru
Wow, that was fast. Thanks. This could work but only partially. (let [stuff car] (new stuff 1982 Mercedes) (new stuff 2001 Seat) ...) I could take advantage of the fact that records are maps: (let [stuff (car. 1982 Mercedes)] ... use Mercedes... (assoc stuff :year 2001 :manufacturer

Re: clojure.contrib.base64

2011-10-06 Thread Allen Johnson
Just wanted to add the Apache commons codec has a base64 encoder/decoder. With a quick test I was able to encode a ~100MB file in 2.3sec. Example code below: In leiningen: [commons-codec 1.4] (require '[clojure.java.io :as io]) (import '[org.apache.commons.codec.binary Base64OutputStream])

Re: how to use record as a value

2011-10-06 Thread Meikel Brandmeyer
Hi, use the factory function. Clojure 1.3.0 user= (defrecord car [year manufacturer]) user.car user= (defn create [stuff] (stuff 1982 Mercedes Benz)) #'user/create user= (create -car) #user.car{:year 1982, :manufacturer Mercedes Benz} You can't pass car. around at runtime because it is a class.

Faster JSON library

2011-10-06 Thread Lars Nilsson
The clojure.contrib.base64 discussion has inspired me (sorry!) to write this.. I would very much like to see a faster JSON parser be in contrib. clj-json can beat clojure.data.json by up to a factor of 140x when reading/parsing and 5x when creating a JSON string. clojure.data.json reading:

Re: how to use record as a value

2011-10-06 Thread Razvan Rotaru
This is what I'm looking for. Thanks. I have not seen this kind of expression before: -foo. Is is created by defrecord or is it implemented at reader level? I realize now that I can also keep a generating function in the variable stuff: (let [stuff #(car. %1 %2)] (stuff 1982 Mercedes) (stuff

Re: clojure.contrib.base64

2011-10-06 Thread Rok Lenarcic
Sure, I can use that file. This DIY attitude doesn't benefit the beginners. I can add and use that java, but 90% of clojure users will use the clojure contrib function and 9% will use faster sun encoder, because people don't know that Sun's implementations are slow and that better ones are

The Website / Wikispaces

2011-10-06 Thread Simon Morgan
When using clojure.org does anybody else quite frequently get the Wikispaces homepage instead? This seems to happen most often when I start Firefox because I always have a clojure.org tab open. Any idea what's causing this? -- You received this message because you are subscribed to the Google

Re: clojure.contrib.base64

2011-10-06 Thread Alexander Taggart
I threw a base64 encoder together a while ago when playing with the new primitive stuff. Interesting to note that it is faster than the one in Apache commons-codec. https://github.com/ataggart/codec/blob/master/src/codec/base64.clj -- You received this message because you are subscribed to

Re: clojure.contrib.base64

2011-10-06 Thread Ray Miller
On 6 October 2011 18:27, Aaron Bedra aaron.be...@gmail.com wrote: This actually introduces an opportunity for a much larger set of utilities. clojure.data.crypto base64 is part of this idea anyways, and putting it in place along with nice wrappers around the messy java crypto bits I think

Re: clojure.contrib.base64

2011-10-06 Thread Stuart Halloway
I threw a base64 encoder together a while ago when playing with the new primitive stuff. Interesting to note that it is faster than the one in Apache commons-codec. https://github.com/ataggart/codec/blob/master/src/codec/base64.clj Do you want to make this the basis for an improved

Re: Exception handling changes in Clojure 1.3.0

2011-10-06 Thread Kevin Downey
On Thu, Oct 6, 2011 at 4:39 AM, Meikel Brandmeyer (kotarak) m...@kotka.de wrote: It does. user= (defn f [] (Class/forName nonexistant)) #'user/f user= (try (f) (catch ClassNotFoundException e caught!)) caught! the problem is in Reflector.java and the call to Class/forName is

Re: clojure.contrib.base64

2011-10-06 Thread Alexander Taggart
Sure, I'll start working on it. Do you want it to be worked on in a contrib project or just submit it once it's functional? Also, I assume you'd want this to work with 1.2, right? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this

Re: The Website / Wikispaces

2011-10-06 Thread Jonathan Fischer Friberg
I do On Thu, Oct 6, 2011 at 2:32 PM, Simon Morgan s...@spamcop.net wrote: When using clojure.org does anybody else quite frequently get the Wikispaces homepage instead? This seems to happen most often when I start Firefox because I always have a clojure.org tab open. Any idea what's causing

Re: how to use record as a value

2011-10-06 Thread Alan Malloy
-foo is new in 1.3. I'm surprised so many people are recommending it without mentioning that. -foo is like foo., except that it's a real clojure function and as such can be passed as a function; you can call apply on it; and so forth. On Oct 6, 11:05 am, Razvan Rotaru razvan.rot...@gmail.com

Re: clojure.contrib.base64

2011-10-06 Thread Stuart Halloway
Sure, I'll start working on it. Do you want it to be worked on in a contrib project or just submit it once it's functional? Whatever works best for you. Also, I assume you'd want this to work with 1.2, right? I won't personally need that. Plus, this is the kind of lib where the code

Re: Problem Running ClojureScript on OpenJDK

2011-10-06 Thread Volker Schlecht
Master works like a charm now - Thanks!! On Oct 4, 5:44 am, db donald.bl...@gmail.com wrote: Works for me.  Thanks. On Oct 3, 10:15 am, Brenton bashw...@gmail.com wrote: If you have been having problems the ClojureScript andOpenJDK, please try the current master branch of

Re: Reuse of generic Clojure/ClojureScript code?

2011-10-06 Thread pmbauer
Do you know if that solution will extend to sharing clojure core libraries where that makes sense (a lot of copy-n-pasted code in [core|set|string|walk|zip].cljs)? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Leiningen Local Repositories

2011-10-06 Thread Michał Marczyk
Hi! Issue #287 [1] seems related to this. I've posted a description of a possible use of unquote in defproject for doing things like (defproject ... ;; private-repo-info comes from ~/.lein/init.clj :repositories ~(user/private-repo-info)) as a comment on the issue. Sincerely, Michał [1]

Re: Faster JSON library

2011-10-06 Thread Tal Liron
An excellent JVM library to use as base is Jackson: http://jackson.codehaus.org/ It would be wonderful to see a Clojure-friendly version of it: having it create Clojure-specific structures from JSON, and also recognizing Clojure deftypes for serialization. The streaming API is friendly enough

Re: Faster JSON library

2011-10-06 Thread David Nolen
clj-json uses Jackson and so does https://github.com/dakrone/cheshire On Thu, Oct 6, 2011 at 8:07 PM, Tal Liron tal.li...@gmail.com wrote: An excellent JVM library to use as base is Jackson: http://jackson.codehaus.org/ It would be wonderful to see a Clojure-friendly version of it: having

Re: Faster JSON library

2011-10-06 Thread Phil Hagelberg
On Thu, Oct 6, 2011 at 5:07 PM, Tal Liron tal.li...@gmail.com wrote: An excellent JVM library to use as base is Jackson: http://jackson.codehaus.org/ It would be wonderful to see a Clojure-friendly version of it Both clj-json and cheshire (https://github.com/dakrone/cheshire) are actually

Re: Faster JSON library

2011-10-06 Thread Tal Liron
Cheshire looks great, thanks for the tip! I wonder, then, what's the OP's problem? I think it's good to have a lightweight, 100% Clojure version of JSON in contrib. A lighter weight is often a higher priority than performance. I think both approaches have their place. In the Java world, too,

Re: Faster JSON library

2011-10-06 Thread Lars Nilsson
As I mentioned in my previous email, my problem isn't really picking a JSON implementation for my own needs, but rather when I use a library that uses a slower implementation. If I wanted to use clutch for couchdb access and didn't pay too much attention as to what leiningen pulls in, I wouldn't

Re: Reuse of generic Clojure/ClojureScript code?

2011-10-06 Thread Dave Sann
fair enough. Is there any support for this at the moment? My only comment would be that it is quite handy to know that you have imported code that might be platform specific. It also seems reasonable that pure clojure code might be used by the .net version. Cheers Dave -- You received

Re: Reuse of generic Clojure/ClojureScript code?

2011-10-06 Thread Dave Sann
I don't see why not, in principle. However, from my perspective when compiling at the moment, these are already taken care of. So I have not looked into this side of things. I think that it would need some thought to get the best solution. Cheers D -- You received this message because you

Re: Faster JSON library

2011-10-06 Thread Dave Sann
In my opinion, the situation is not clear cut: I might want a slower but more portable library if porting clutch to clojurescript. (I read that someone has this working...) I might just want a lib that works if moving to .net in the short term but optimise with a faster library later.

Re: Faster JSON library

2011-10-06 Thread Meikel Brandmeyer (kotarak)
Hi, slf4j comes to mind. Have a standard API which is provided by the different libraries. If you were targeting clojurescript you'd specify the portable library. For a server application running on the JVM you'd specify a fast Jackson-based implementation. This leaves the choice to the user