Re: defs in Clojurescript REPL

2012-05-15 Thread kovas boguta
I'd rather see something at the beginning or at the end of the statement. like ^:toss (def ...) or (def ...) ;; On Tue, May 15, 2012 at 6:50 AM, Michał Marczyk wrote: > Workaround: > > (do (def foo (build-something-enormous)) nil) > > As for the reason for this behaviour -- probably non other

ANN clj-wallhack

2012-05-15 Thread Allen Rohner
I've resurrected old school clojure.contrib.java-utils/wall-hack- {method,field} into a new library https://github.com/arohner/clj-wallhack Thanks to hiredman for the original implementation. Allen -- You received this message because you are subscribed to the Google Groups "Clojure" group. To

Re: Unable to replace static Java method with Clojure function

2012-05-15 Thread Meikel Brandmeyer (kotarak)
Hi, you are sure that your AOT compiled class files are on the classpath before compiling the Java side? Kind regards Meikel -- 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 pos

Re: Clojurescript NS question

2012-05-15 Thread Oded Badt
Sorry, meant to quote: " :use is not supported " On Wednesday, May 16, 2012 8:36:24 AM UTC+3, Oded Badt wrote: > > In: > https://github.com/clojure/clojurescript/wiki/Differences-from-Clojure > It is written than: > "You must use the :as form of :require " > > Does this basically mean there

Clojurescript NS question

2012-05-15 Thread Oded Badt
In: https://github.com/clojure/clojurescript/wiki/Differences-from-Clojure It is written than: "You must use the :as form of :require " Does this basically mean there is no natural way to write a set of functions and import them globally (with no namespace prefix)? For example I would like

Unable to replace static Java method with Clojure function

2012-05-15 Thread Matthew Boston
I currently have a static method in Java. I have rewritten it in Clojure. I wish to allow the rest of the Java app to call the new function with minimal change. Still getting "NumberValidator cannot be resolved" even after reading the following SO post and it's not helping for my particular sit

Re: Best way to write an InputStream to disk

2012-05-15 Thread Raju Bitter
Thanks a lot, that worked for me. Raju -- 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 posts from new members are moderated - please be patient with your first post. To unsubscr

Re: Best way to write an InputStream to disk

2012-05-15 Thread Robert Marianski
On Wed, May 16, 2012 at 02:15:59AM +0200, Raju Bitter wrote: > What is the best way to write an FilterInputStream or InputStream do > disk? I'm downloading a file using the clj-http library: > > (:body (client/get > "http://www.openlaszlo.org/pipermail/laszlo-dev/2012-May.txt.gz"; {:as > :stream})

Best way to write an InputStream to disk

2012-05-15 Thread Raju Bitter
What is the best way to write an FilterInputStream or InputStream do disk? I'm downloading a file using the clj-http library: (:body (client/get "http://www.openlaszlo.org/pipermail/laszlo-dev/2012-May.txt.gz"; {:as :stream}) That returns the response body as a FilteredInputStream, which I need t

Re: Reducers

2012-05-15 Thread Rich Hickey
Fixed - thanks. Rich On May 15, 2012, at 3:54 PM, Robert McIntyre wrote: > There's a right parenthesis missing at > http://clojure.com/blog/2012/05/15/anatomy-of-reducer.html : > > Now: > > (reduce + 0 (map inc [1 2 3 4])) > ;;becomes > (reduce + 0 (reducer [1 2 3 4] (mapping inc)) < MISSING P

Re: docstrings of if-let and when-let incorrect

2012-05-15 Thread Dan Cross
On Tue, May 15, 2012 at 3:47 PM, Walter Tetzner wrote: > On Tuesday, May 15, 2012 3:41:58 PM UTC-4, Dan Cross wrote: >> My own personal opinion is that it makes sense in combination with 'and', >> but others may feel differently.  E.g., >> >>     (when-let [a (allocate-thing) b (read-into-thing a)

Re: Faster application startup for rapid development

2012-05-15 Thread MarkSwanson
> reloading code at the REPL, because old background threads may still be > running with old code. So I end up restarting the process many times per > day. I usually create a 'restart fn that closes down the background threads and services and restarts them. This might require you to add a 'shutdo

[ANN] clojure-encog 0.3.0 released on clojars

2012-05-15 Thread Jim - FooBar();
Hello folks, I'm happy to announce the release of clojure-encog, a thin wrapper around Encog AI framework 3.1. Basically i did this so i could use it for a project of mine but I guess someone else might find it useful as well...especially if someone does not want to get down and dirty with Jav

Re: Bootstrapping Clojure-in-Clojure

2012-05-15 Thread Timothy Baldridge
>the point of the analysis step is to generate a richer (more verbose) >set of information about the code, there is a lot of information you >would like to have when compiling (for example, for some platforms it >would be nice to know at the start of a function what locals exist in >the that functi

Re: docstrings of if-let and when-let incorrect

2012-05-15 Thread Michael Gardner
On May 15, 2012, at 3:15 PM, Andy Fingerhut wrote: > If if-let/when-let had multiple bindings, how would you propose to define the > condition of whether to do the "then" branch? > > As the logical AND of all of the multiple forms? The OR? Only use the first > expression? Only the last? > >

Re: docstrings of if-let and when-let incorrect

2012-05-15 Thread Andy Fingerhut
If if-let/when-let had multiple bindings, how would you propose to define the condition of whether to do the "then" branch? As the logical AND of all of the multiple forms? The OR? Only use the first expression? Only the last? I don't see that any of those is any more clear or "least surpris

Re: Bootstrapping Clojure-in-Clojure

2012-05-15 Thread David Nolen
On Tue, May 15, 2012 at 4:03 PM, Timothy Baldridge wrote: > > Why can't it port to Python? You have can have an instance with a method > > toString right? > > The python version of that code (at least in clojure-py) would be this: > > (defn as-str [x] (py/str x)) > That would be defined core.cljs

Re: Bootstrapping Clojure-in-Clojure

2012-05-15 Thread Kevin Downey
On Tue, May 15, 2012 at 12:51 PM, Timothy Baldridge wrote: >>  I can certainly imagine cases where the analyzer might want >> reflection on types etc of the given platform, but I think that is >> really an optimization, trading off compile/analyzer time reflection >> for runtime reflection. That p

Re: Bootstrapping Clojure-in-Clojure

2012-05-15 Thread Timothy Baldridge
> Why can't it port to Python? You have can have an instance with a method > toString right? The python version of that code (at least in clojure-py) would be this: (defn as-str [x] (py/str x)) So my point is that some platforms may define toString, other define str and still others (CLR) define

Re: Bootstrapping Clojure-in-Clojure

2012-05-15 Thread David Nolen
On Tue, May 15, 2012 at 3:51 PM, Timothy Baldridge wrote: > (defn as-str [x] (.toString x)) > > That can't port to Python, or really any other VM besides JS. So if > we're looking at translating the analyzer itself we have to develop > some sort of base set of libraries that every thing else can b

Re: Reducers

2012-05-15 Thread Robert McIntyre
There's a right parenthesis missing at http://clojure.com/blog/2012/05/15/anatomy-of-reducer.html : Now: (reduce + 0 (map inc [1 2 3 4])) ;;becomes (reduce + 0 (reducer [1 2 3 4] (mapping inc)) < MISSING PAREN under the heading "Reducers" sincerely, --Robert McIntyre, Dylan Holmes On Tue, Ma

Re: Bootstrapping Clojure-in-Clojure

2012-05-15 Thread Timothy Baldridge
>  I can certainly imagine cases where the analyzer might want > reflection on types etc of the given platform, but I think that is > really an optimization, trading off compile/analyzer time reflection > for runtime reflection. That platform reflective information would be > provided by something

Re: docstrings of if-let and when-let incorrect

2012-05-15 Thread Walter Tetzner
On Tuesday, May 15, 2012 3:41:58 PM UTC-4, Dan Cross wrote: > > My own personal opinion is that it makes sense in combination with 'and', > but others may feel differently. E.g., > > (when-let [a (allocate-thing) b (read-into-thing a) c > (extract-something-from-thing b)] > (do-somethi

Re: docstrings of if-let and when-let incorrect

2012-05-15 Thread Dan Cross
On Tue, May 15, 2012 at 3:26 PM, Aaron Cohen wrote: > Does the principle of least surprise suggest that multiple bindings be > combined with AND or OR? My own personal opinion is that it makes sense in combination with 'and', but others may feel differently. E.g., (when-let [a (allocate-t

Re: docstrings of if-let and when-let incorrect

2012-05-15 Thread Walter Tetzner
On Tuesday, May 15, 2012 3:26:52 PM UTC-4, Aaron Cohen wrote: > > Does the principle of least surprise suggest that multiple bindings be > combined with AND or OR? > > For `when-let', I would expect it to work like nested when-lets: (when-let [x (exp-1) y (exp-2 x) z (exp-

Re: docstrings of if-let and when-let incorrect

2012-05-15 Thread Aaron Cohen
Does the principle of least surprise suggest that multiple bindings be combined with AND or OR? --Aaron On Tue, May 15, 2012 at 3:09 PM, Hubert Iwaniuk wrote: > I tried using if-let with multiple binding in past as well. > Following least surprise principle, I would like to see support for > mu

Re: docstrings of if-let and when-let incorrect

2012-05-15 Thread Evan Gamble
If if-let and when-let don't get support for multiple bindings, you could try https://github.com/egamble/let-else . On Tuesday, May 15, 2012 12:09:08 PM UTC-7, Hubert Iwaniuk wrote: > > I tried using if-let with multiple binding in past as well. > Following least surprise principle, I would like

Re: Bootstrapping Clojure-in-Clojure

2012-05-15 Thread Kevin Downey
On Tue, May 15, 2012 at 11:25 AM, Timothy Baldridge wrote: >> Logically the interface between the analyzer and the emitter is data >> (maps, etc) which can be serialized as json or some platform specific >> representation. Then all you need to do is write an emitter on your >> platform of choice t

Re: docstrings of if-let and when-let incorrect

2012-05-15 Thread Hubert Iwaniuk
I tried using if-let with multiple binding in past as well. Following least surprise principle, I would like to see support for multiple bindings. Cheers, Hubert. Vinzent May 15, 2012 5:47 PM Or maybe if-let and when-let should support multiple bindings, like the

Re: Reducers

2012-05-15 Thread Rich Hickey
I've written another post which goes into the reducers in more detail: http://clojure.com/blog/2012/05/15/anatomy-of-reducer.html Rich On May 10, 2012, at 1:26 PM, Christian Romney wrote: > > > On Thursday, May 10, 2012 8:02:09 AM UTC-4, Nicolas Oury wrote: > I can describe the background to

Re: Bootstrapping Clojure-in-Clojure

2012-05-15 Thread Timothy Baldridge
> Logically the interface between the analyzer and the emitter is data > (maps, etc) which can be serialized as json or some platform specific > representation. Then all you need to do is write an emitter on your > platform of choice that can emit code for the data. > > So for Python: > 1. run the

Re: Bootstrapping Clojure-in-Clojure

2012-05-15 Thread Kevin Downey
On Tue, May 15, 2012 at 8:05 AM, Timothy Baldridge wrote: > There seems to be a few steps involved in this from, what I'm seeing. > > From what I'm seeing of the source, there's two files I'll be dealing with > > closure.clj -- defines functions for looking up info about libraries, > functions, et

Re: defstruct defrecord metadata

2012-05-15 Thread JDuPreez
Stefan, Thank you for your reply. You are referring to applying an annotation to an instance/object. If we could imagine it existed for the moment, this is what I'd be looking for: (meta {:foo "meta"} (defrecord Foo (bar baz))) I should then somehow be able to retrieve the metadata of the type

Re: docstrings of if-let and when-let incorrect

2012-05-15 Thread Vinzent
Or maybe if-let and when-let should support multiple bindings, like the doc states. воскресенье, 13 мая 2012 г., 4:55:40 UTC+6 пользователь Borkdude написал: > > The docstring of if-let is as follows: > > bindings => binding-form test > > If test is true, evaluates then with binding-form bound to

Re: Reducers

2012-05-15 Thread Stuart Sierra
It's fixed now. On Friday, May 11, 2012 12:30:47 PM UTC-4, Sean Corfield wrote: > > Just to clarify: Clojure isn't building at the moment _on > build.clojure.org_ but you can build it yourself easily enough: > > -- You received this message because you are subscribed to the Google Groups "Cloj

Re: docstrings of if-let and when-let incorrect

2012-05-15 Thread Stuart Sierra
Reasonable enough. Patch welcome. -S -- 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 posts from new members are moderated - please be patient with your first post. To unsubscribe

Re: Bootstrapping Clojure-in-Clojure

2012-05-15 Thread Timothy Baldridge
There seems to be a few steps involved in this from, what I'm seeing. >From what I'm seeing of the source, there's two files I'll be dealing with closure.clj -- defines functions for looking up info about libraries, functions, etc. compiler.clj -- actually defines the compiler To start with, I'm

A Clout-like route-matching lib for ClojureScript.

2012-05-15 Thread eduardoejp
Made it for a project I'm working on. Thought it'd be nice to open-source it. It's called Snout. https://github.com/eduardoejp/snout -- 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 t

Re: defstruct defrecord metadata

2012-05-15 Thread Stefan Kamphausen
Hi, I am not sure whether I fully understand your question. However, when you create a record, a second constructor will be created for you which also expects a meta-data map: user=> (defrecord Foo (bar baz)) user=> (meta (Foo. 2 3 {:foo "meta"} nil)) {:foo "meta"} Hope that helps. Stefan -

Re: defstruct defrecord metadata

2012-05-15 Thread Tim Visher
On Sat, May 12, 2012 at 3:48 PM, JDuPreez wrote: > I'm new to Clojure. I've been unsuccessful in finding a clear answer or > getting it to work (might just have done it incorrectly, since I'm still > learning). I understand that you can add metadata to an object, "with-meta", > and to a variable o

Re: How to use third-party libraries with Leiningen that are not found in Clojars or Maven

2012-05-15 Thread Tim Visher
On Sat, May 12, 2012 at 12:36 PM, Mads Andreas Elvheim wrote: > I have a few issues which are all related. I'll do my best to explain them > one by one. > > I'd like to use the latest version of the jOGL library with Clojure 1.3 / > Leiningen 1.7.1 / OpenJDK 1.6. > > After getting the jars from jo

Re: defrecord serialization and *data-readers*

2012-05-15 Thread Stuart Sierra
Data reader literals are not intended to replace record serialization. If you want the flexibility to change your record types, I think you need to use data reader literals from the beginning, and have them deserialize as the appropriate record type. -S -- You received this message because yo

Re: defs in Clojurescript REPL

2012-05-15 Thread Michał Marczyk
Workaround: (do (def foo (build-something-enormous)) nil) As for the reason for this behaviour -- probably non other than it's just the easiest thing for def in ClojureScript to do; "it" being to inherit the return value from the JavaScript assignment def compiles to. Sticking a void () around t

Re: defs in Clojurescript REPL

2012-05-15 Thread David Nolen
Returning the symbol seems odd at least to me. I think the best we could do is have a compiler flag so that defs can return nil for REPLs. On Tuesday, May 15, 2012, kovas boguta wrote: > Yeah, that is sort of what I was implying in "changing the semantics of > def" > > Though I wasn't ready to to

Re: Faster application startup for rapid development

2012-05-15 Thread Michael Gardner
There's also nailgun: it keeps a JVM running in the background that Java programs can connect to, eliminating JVM startup time completely. It's totally insecure on multi-user machines and hasn't been updated in a while, but it may be sufficient to ease the pain on developer machines. -- You re