(finally) got all class signature changes w/gen-class reloading at runtime

2011-02-09 Thread Robert Campbell
Back in January I found myself writing some gen-class to connect my Clojure library to my Java project. Until now I'd been spoiled by Clojure's dynamic, interactive nature, so running up against the whole stub class signature can't change w/out jvm reboot thing hurt a bit. I found a partial

cake bin usage

2011-02-09 Thread Sunil S Nandihalli
Hello everybody, I am trying to use cake bin to build a standalone exe ... and I am having trouble with it .. I when I try to do it in a simple project .. It works fine .. And I closely followed the same project file in the one that I actually wanted to build an exe of and it was not working

Help understanding macro

2011-02-09 Thread Andreas Kostler
Hello all, I've come across the following macro, which basically tries to execute body and times out after ms milliseconds. It works fine :) (defmacro time-limited [ms body] `(let [f# (future ~@body)] (. get f# ~ms java.util.concurrent.TimeUnit/MILLISECONDS))) If I do a (macroexpand

Crack-proofing the Scratch Lottery Code [long]

2011-02-09 Thread Ken Wesson
It's likely that many of you have read, or at least encountered links to, this Wired article recently: http://www.wired.com/magazine/2011/01/ff_lottery/all/1 In it, a particular tic-tac-toe themed scratch lottery is examined in detail. A mathematician, Mohan Srivastava, discovered weaknesses in

Re: Help understanding macro

2011-02-09 Thread Ken Wesson
On Wed, Feb 9, 2011 at 6:07 AM, Andreas Kostler andreas.koestler.le...@gmail.com wrote: Hello all, I've come across the following macro, which basically tries to execute body and times out after ms milliseconds. It works fine :) (defmacro time-limited [ms body]  `(let [f# (future ~@body)]

Re: http.async.client v0.2.2 released

2011-02-09 Thread Hubert Iwaniuk
Hi Takahiro, Thank you for your feedback. Inline are my answers. On Feb 9, 2011, at 8:13 AM, Takahiro Hozumi wrote: Hi, Thank you for the introduction. Here is my little feed back: 1. I want to see a example using callbacks. Documentation on on callbacks can be found here:

Re: http.async.client v0.2.2 released

2011-02-09 Thread László Török
Hi, I've been using http.async.client for my play projects and it seems very promising. Thanks for this awesome library! :) Las 2011/2/9 Hubert Iwaniuk neo...@kungfoo.pl Hi Takahiro, Thank you for your feedback. Inline are my answers. On Feb 9, 2011, at 8:13 AM, Takahiro Hozumi wrote:

VimClojure omnicompletion woes

2011-02-09 Thread Wolodja Wentland
Hello, I would like to note that I am fairly new to Clojure and its ecosystem, so please forgive me if I ask pretty basic questions. :) Given that I am just learing I tried to set up my developing tools first and am quite happy with my setup, but have one annoying problem. I am using vim with

Re: VimClojure omnicompletion woes

2011-02-09 Thread Meikel Brandmeyer
Hi, omni completion is aware of the namespace of the file you are currently editing. It only provides completions which make sense for this namespace. Example: (ns foo.bar (:require [clojure.contrib.condition :as error])) Then you will be able to complete eg. err to error and error/ra to

Re: VimClojure omnicompletion woes

2011-02-09 Thread Meikel Brandmeyer
Hi, On 9 Feb., 11:38, Wolodja Wentland babi...@gmail.com wrote:         [vimclojure/server 2.3.0-SNAPSHOT] As a sidenote: you probably want 2.2.0 here instead of the SNAPSHOT. The SNAPSHOT may break in arbitrarily funny ways at even more funny points in time and may even remain broken for a

Re: http.async.client v0.2.2 released

2011-02-09 Thread Hubert Iwaniuk
Hi Las, Glad you like it! What would like to see in upcoming releases of http.async.client? Thank you! Cheers, Hubert. On Feb 9, 2011, at 12:56 PM, László Török wrote: Hi, I've been using http.async.client for my play projects and it seems very promising. Thanks for this awesome

Sorting of function definitions in namespaces

2011-02-09 Thread jkrueger
When writing a Clojure namespace very often I would like to sort my functions according to level of abstraction, starting with the most abstract functions, followed by helper functions to the more abstract functions, and so on. This way of organizing code is promoted as good style by the Clean

Re: Crack-proofing the Scratch Lottery Code [long]

2011-02-09 Thread labwork07
But that doesn't help me win the lottery :-) On Feb 9, 2011 6:21am, Ken Wesson kwess...@gmail.com wrote: It's likely that many of you have read, or at least encountered links to, this Wired article recently: http://www.wired.com/magazine/2011/01/ff_lottery/all/1 In it, a particular

Performance of FSharpMap vs PersistentHashMap

2011-02-09 Thread Timothy Baldridge
I ran some tests this morning comparing FSharpMap (http://msdn.microsoft.com/en-us/library/ee353686.aspx) to the Clojure-CLR PersistentHashMap. Both are immutable maps with more or less the same features. My benchmark inserted 5 items into the map, retrieved them and then removed them one by

Re: http.async.client v0.2.2 released

2011-02-09 Thread Rob Wolfe
On 7 Lut, 19:30, Hubert Iwaniuk neo...@kungfoo.pl wrote: Hi All, Just released v0.2.2 of HTTP Asynchronous Client. I have some problem using this library. Having such simple testing program: code (ns test.http (:require [http.async.client :as c])) (defn test-http [] (println start)

load-file from a script

2011-02-09 Thread Vitaly Peressada
I want to have options in clojure file which I want to load from a script. Script later will use global *input-config* to do its work. ;; c:\inputgen-config.clj ; Input configuration (def *input-config* { :buy-vs-sell-length 1.0, :shorter-length 10, :min-price 0.0,

Re: load-file from a script

2011-02-09 Thread Meikel Brandmeyer
Hi, since the file is loaded during runtime, the compiler can't know at compile whats in there. You may want to declare *input-config* before your -main function. Sincerely Meikel -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group,

Re: http.async.client v0.2.2 released

2011-02-09 Thread Hubert Iwaniuk
Hi Rob, You need to close the client once you are done with it. Please see Managing http.async.client of manual especially Closing http.async.client http://neotyk.github.com/http.async.client/docs.html#sec-1_2_6_11 HTH, Hubert. On Feb 9, 2011, at 3:29 PM, Rob Wolfe wrote: On 7 Lut, 19:30,

Re: http.async.client v0.2.2 released

2011-02-09 Thread Rob Wolfe
I created another test function like this: code (defn test-http-with-close [] (println start) (binding [*client* (c/create-client)] (let [response (c/GET http://github.com/neotyk/ http.async.client/)] (println await) (c/await response) (println string) (println

Re: load-file from a script

2011-02-09 Thread Vitaly Peressada
Thanks, Meikel. Makes sense. On Feb 9, 9:48 am, Meikel Brandmeyer m...@kotka.de wrote: Hi, since the file is loaded during runtime, the compiler can't know at compile whats in there. You may want to declare *input-config* before your -main function. Sincerely Meikel -- You received this

Are variadic protocol functions supposed to work?

2011-02-09 Thread Chris
There is an old thread from last year about broken variadic functions defined in a protocol [1]. It ended with a question as to whether it was ever intended for protocols to support variadic functions, but it was never answered. I just ran into this issue myself and am curious; I don't recall

Re: http.async.client v0.2.2 released

2011-02-09 Thread Hubert Iwaniuk
Hi Rob, Please see following code: (ns twitter-stream (:require [http.async.client :as c] [org.danlarkin.json :as j])) (def u ...) (def p ...) (defn -main [] (let [resp (c/stream-seq :get http://stream.twitter.com/1/statuses/sample.json; :auth {:user

Re: http.async.client v0.2.2 released

2011-02-09 Thread Rob Wolfe
Hubert Iwaniuk neo...@kungfoo.pl writes: oh man, there was just missing c/close, silly me ;) now this function works perfectly: code (defn test-working [] (let [response (c/GET http://github.com/neotyk/http.async.client/;)] (c/await response) (println (c/string response))

Re: (finally) got all class signature changes w/gen-class reloading at runtime

2011-02-09 Thread George Jahad
so i think most java debuggers, even jdb, are capable of reloading classes aren't they? i haven't tried your example, but in the cdt, you use the .redefineClasses method to reload a java class For example, I can hack on one of the classes in clojure compiler and reload it, without restarting,

evalive a go go

2011-02-09 Thread Fogus
Hi all. I've mentioned my spunky little library evalive numerous times, but never got around to announcing it officially. Well here you go. evalive: a tiny clojure library providing another eval... and destro. http://github.com/fogus/evalive or http://fogus.me/fun/evalive/ Have fun. --

[ANN] clj-ldap - Clojure LDAP client

2011-02-09 Thread Saul Hazledine
Hello I've written clj-ldap which is a thin layer on the unboundid ldap sdk and allows clojure programs to talk to ldap servers. I'm keen to get feedback on API and am happy to change it if needed. (ns example (:require [clj-ldap.client :as ldap])) (def ldap-server (ldap/connect {:host

Re: (finally) got all class signature changes w/gen-class reloading at runtime

2011-02-09 Thread George Jahad
I studied it a bit more and noticed that the jdi redefineClasses method can't add new methods, (as you imply in your blog.) That's what's special about what JRebel offers. The redefineClasses method is described here:

Tricky Macro to write.

2011-02-09 Thread CuppoJava
Hello everyone, I'm having trouble writing the following tricky macro. I think I might need some feature that Clojure doesn't have, but I'm not sure. Description: (bind-later bindings body) and (do-binding body) (bind-later) is used like a let-form, except that it doesn't *immediately* make

Re: Help understanding macro

2011-02-09 Thread Andreas Kostler
Hi Ken, Thanks again. However, I still have one nagging gap in understanding this macro. If I replace (defmacro time-limited [ms body] `(let [f# (future ~@body)] (. get f# ~ms java.util.concurrent.TimeUnit/MILLISECONDS))) which expands to: (macroexpand-1 '(time-limited 1000 (println

Re: Help understanding macro

2011-02-09 Thread Ken Wesson
On Thu, Feb 10, 2011 at 12:06 AM, Andreas Kostler andreas.koestler.le...@gmail.com wrote: Hi Ken, Thanks again. However, I still have one nagging gap in understanding this macro. If I replace (defmacro time-limited [ms body]  `(let [f# (future ~@body)]    (. get f# ~ms

Re: VimClojure omnicompletion woes

2011-02-09 Thread Wilson MacGyver
Is vimclojure/server 2.2.0 in clojar? I searched and all I saw are http://clojars.org/vimclojure/server which is 2.3.0-SNAPSHOT On Wed, Feb 9, 2011 at 7:38 AM, Meikel Brandmeyer m...@kotka.de wrote: Hi, On 9 Feb., 11:38, Wolodja Wentland babi...@gmail.com wrote:         [vimclojure/server

Re: VimClojure omnicompletion woes

2011-02-09 Thread Meikel Brandmeyer
Hi, On 10 Feb., 07:42, Wilson MacGyver wmacgy...@gmail.com wrote: Is vimclojure/server 2.2.0 in clojar? Yes. http://clojars.org/repo/vimclojure/server/2.2.0/server-2.2.0.jar Sincerely Meikel -- You received this message because you are subscribed to the Google Groups Clojure group. To post

Re: Tricky Macro to write.

2011-02-09 Thread Meikel Brandmeyer
Hi, here my try: (def *deferred-bindings* {}) (defmacro do-binding [ body] `(with-bindings *deferred-bindings* ~@body)) (defmacro bind-later [bindings body] (let [vars (map (fn [v] `(var ~v)) (take-nth 2 bindings)) values (take-nth 2 (next bindings))] `(binding

Re: VimClojure omnicompletion woes

2011-02-09 Thread Wilson MacGyver
ah, it looks like clojars doesn't show older version in the search result. On Thu, Feb 10, 2011 at 1:56 AM, Meikel Brandmeyer m...@kotka.de wrote: Hi, On 10 Feb., 07:42, Wilson MacGyver wmacgy...@gmail.com wrote: Is vimclojure/server 2.2.0 in clojar? Yes.

Re: Tricky Macro to write.

2011-02-09 Thread Meikel Brandmeyer
Whoops. Misclick. Sorry Here again: (def *deferred-bindings* {}) (defmacro do-binding [ body] `(with-bindings *deferred-bindings* ~@body)) (defmacro bind-later [bindings body] (let [vars (map (fn [v] `(var ~v)) (take-nth 2 bindings)) values (take-nth 2 (next bindings))]

Re: VimClojure omnicompletion woes

2011-02-09 Thread Meikel Brandmeyer
Hi, On 10 Feb., 08:08, Wilson MacGyver wmacgy...@gmail.com wrote: ah, it looks like clojars doesn't show older version in the search result. The clojars search sucks quite a bit. At least it did last time I looked. Sincerely Meikel -- You received this message because you are subscribed to

Re: [ANN] clj-ldap - Clojure LDAP client

2011-02-09 Thread Jozef Wagner
Hi, Thank you, it is a useful library. If it was released two days ago, I wouldn't have to make my own ad-hoc wrapper around unboundid :) One question, If I search for some entries, you return results as a sequence of maps. How do I get dn of some result? It seems that your entry-as-map