Re: including sound or image files with Leiningen uberjar command

2011-09-16 Thread Joost
On Sep 16, 7:20 am, loonster tbur...@acm.org wrote: Sound or image files will show up in the resulting uberjar if they reside in a /resources subdirectory of a Leiningen home project directory.  I can't find any documentation for how to refer to and load such resource files within a

Re: How to convert general recursion to loop .. recur syntax

2011-09-16 Thread Herwig Hochleitner
Am Donnerstag, 15. September 2011 schrieb Ken Wesson : On Thu, Sep 15, 2011 at 8:56 AM, Herwig Hochleitner hhochleit...@gmail.com javascript:; wrote: Consider (defn find-in-tree ([tree pred?] (concat (filter pred? tree) (mapcat find-in-tree (filter sequential? tree)

Clojure embedded in a Java Application

2011-09-16 Thread Eamonn
Hi I'm new to Clojure so forgive me if this is a dumb question. I want to incorporate some Clojure into a Java application. String rule=(str key val label); String str = (ns test) + (defn foo [key val label] + rule +

Re: including sound or image files with Leiningen uberjar command

2011-09-16 Thread willyh
I use the following helper function: (defn getResource Load resource. This is guaranteed to work with JNLP'd jars. [resource-string] (.getResource (.getContextClassLoader (Thread/currentThread)) resource-string)) Note the comment. I had a lot of trouble loading resources when my uberjars

Wrapping an expression inside a function

2011-09-16 Thread rakesh
Given a list of vectors, I want to return a list of vector whose elements are grouped by index. For example: Given [:a :b] [:c :d] = [:a :c] [:b :d] For this, I wrote the expression (map (partial conj []) [:a :b] [:c :d]) = [:a :c] [:b :d] It returned the right answer. Now I want wrap the above

Re: including sound or image files with Leiningen uberjar command

2011-09-16 Thread Dave Ray
Note that this implementation is the same as (clojure.java.io/resource) [1]. Dave [1] https://github.com/clojure/clojure/blob/3a3374f714e5a755b7de2a761f37696f07a74e80/src/clj/clojure/java/io.clj#L422 On Fri, Sep 16, 2011 at 8:58 AM, willyh wheine...@gmail.com wrote: I use the following

Re: Wrapping an expression inside a function

2011-09-16 Thread Meikel Brandmeyer (kotarak)
Hi, the use of a apply should work. Also note the (partial conj []) is not necessary. vector works as well. user= (defn columns [ xs] (apply map vector xs)) #'user/columns user= (columns [:a :b] [:c :d]) ([:a :c] [:b :d]) Sincerely Meikel -- You received this message because you are

Re: Wrapping an expression inside a function

2011-09-16 Thread Ulises
Not the right answer. I tried to use the apply function with no success. How can I wrap the expression inside a function. Why not use partition and interleave? user (partition 2 (interleave [:a :b] [:c :d])) ((:a :c) (:b :d)) U -- You received this message because you are subscribed to the

Re: Clojure embedded in a Java Application

2011-09-16 Thread Bronsa
The problem could be that #{} in clojure is a set literal, try using clojure.lang.PersistentHashSet/create Hi I'm new to Clojure so forgive me if this is a dumb question. I want to incorporate some Clojure into a Java application. String rule=(str key val label);

Re: Clojure embedded in a Java Application

2011-09-16 Thread Meikel Brandmeyer (kotarak)
Hi, Am Donnerstag, 15. September 2011 23:39:10 UTC+2 schrieb Eamonn: The code works BUT if I try to pass in a map for example like so Object result = foo.invoke( hello,world,#{:a 1 :b 2}); This does not pass a map to the function, but the string #{:a 1 :b 2}. And from your example I

good example of clojure swing db program

2011-09-16 Thread jayvandal
I would like to see a listing of a swing type CRD database program to see how the items go together. Thanks, still trying to relate to Clojre type programming -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

org.clojure:java.classpath 0.2.0 released

2011-09-16 Thread Stuart Sierra
http://search.maven.org/#artifactdetails%7Corg.clojure%7Cjava.classpath%7C0.2.0%7Cjar Fixes http://dev.clojure.org/jira/browse/CLASSPATH-2 -Stuart Sierra clojure.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Rounding the edges of an Emacs beginner

2011-09-16 Thread Timothy Washington
I've sectioned off most of this evening to try out these tricks and treats. So far, it's all working well with 'evil'http://gitorious.org/evil/pages/Home, and swank debugging http://www.youtube.com/watch?v=galfpq969Hg. Tim On Thu, Sep 15, 2011 at 11:32 AM, gaz jones

Re: org.clojure:java.classpath 0.2.0 released

2011-09-16 Thread Herwig Hochleitner
I can't look at http://dev.clojure.org/jira/browse/CLASSPATH-2 Is it set to non-public? Am Freitag, 16. September 2011 schrieb Stuart Sierra : http://search.maven.org/#artifactdetails%7Corg.clojure%7Cjava.classpath%7C0.2.0%7Cjar Fixes http://dev.clojure.org/jira/browse/CLASSPATH-2 -Stuart

misuse of or bug in transients?

2011-09-16 Thread Sergey Didenko
When I convert the following code to use transients it returns different result. Am I doing anything wrong or is it a bug in transients? (defn tt [] (loop [i 0 tset #{}] (if (= i (int 5e5)) (count tset) (recur (inc i) (let [nn (rem (* i (int 1e3)) 131071)

android / mobile help

2011-09-16 Thread Raoul Duke
hi, i dream of having a remote repl onto e.g. android so that i can try to reduce the write-push-run-test-debug-repeat cycle time. pretty please, does anybody have insights / experience / git hub forks / ideas about this? getting to a point where i can do code updates more easily, in fragments,

Re: android / mobile help

2011-09-16 Thread David Nolen
On Fri, Sep 16, 2011 at 1:24 PM, Raoul Duke rao...@gmail.com wrote: hi, i dream of having a remote repl onto e.g. android so that i can try to reduce the write-push-run-test-debug-repeat cycle time. pretty please, does anybody have insights / experience / git hub forks / ideas about this?

Re: android / mobile help

2011-09-16 Thread Raoul Duke
hi, On Fri, Sep 16, 2011 at 10:36 AM, David Nolen dnolen.li...@gmail.com wrote: Have you considered using ClojureScript instead? i had not. my context probably won't allow it, frankly. things need to be as close to native as possible to stand a snowball's chance in hell of being allowed :-)

Re: android / mobile help

2011-09-16 Thread David Nolen
On Fri, Sep 16, 2011 at 1:38 PM, Raoul Duke rao...@gmail.com wrote: hi, On Fri, Sep 16, 2011 at 10:36 AM, David Nolen dnolen.li...@gmail.com wrote: Have you considered using ClojureScript instead? i had not. my context probably won't allow it, frankly. things need to be as close to

Re: misuse of or bug in transients?

2011-09-16 Thread Alan Malloy
Certainly looks like a valid use of transients. Might be related to http://dev.clojure.org/jira/browse/CLJ-829 but I dunno. On Sep 16, 9:55 am, Sergey Didenko sergey.dide...@gmail.com wrote: When I convert the following code to use transients it returns different result. Am I doing anything

Re: misuse of or bug in transients?

2011-09-16 Thread Mark Engelberg
Here's what I speculate the problem is: Last time I checked, contains? doesn't work on transient sets. Try rewriting (contains? tset %) as (tset %). Let me know if that change fixes your program. This is a bug I reported something like 1-2 years ago. If this turns out to be the source of your

Re: android / mobile help

2011-09-16 Thread daly
I have the android build cycle down to a single command that creates an installable apk file. If I do this on a machine with a web server I can put the apk file into a directory with a web page link. So all that would be needed is a form that has a build button on it and downloads the updated

Re: misuse of or bug in transients?

2011-09-16 Thread David Nolen
On Fri, Sep 16, 2011 at 2:07 PM, Mark Engelberg mark.engelb...@gmail.comwrote: Here's what I speculate the problem is: Last time I checked, contains? doesn't work on transient sets. Try rewriting (contains? tset %) as (tset %). Let me know if that change fixes your program. This is a bug I

Re: misuse of or bug in transients?

2011-09-16 Thread Sergey Didenko
Then it is contrary to the docs: http://clojure.org/transients Transients support the read-only interface of the source, i.e. you can call nth, get, count and fn-call a transient vector, just like a persistent vector. Examining the Java sources it looks like the transient collections do not

Re: misuse of or bug in transients?

2011-09-16 Thread Sergey Didenko
Yes, now it works. Thanks. Try rewriting (contains? tset %) as (tset %). Let me know if that change fixes your program. -- 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

Re: misuse of or bug in transients?

2011-09-16 Thread Aaron Cohen
On Fri, Sep 16, 2011 at 2:20 PM, David Nolen dnolen.li...@gmail.com wrote: On Fri, Sep 16, 2011 at 2:07 PM, Mark Engelberg mark.engelb...@gmail.comwrote: Here's what I speculate the problem is: Last time I checked, contains? doesn't work on transient sets. Try rewriting (contains? tset %)

Re: misuse of or bug in transients?

2011-09-16 Thread Mark Engelberg
On Fri, Sep 16, 2011 at 11:20 AM, David Nolen dnolen.li...@gmail.comwrote: Examining the Java sources it looks like the transient collections do not support contains? by design. David Unfortunately, another design decision in Clojure is that contains? returns spurious results, rather than

Re: misuse of or bug in transients?

2011-09-16 Thread David Nolen
On Fri, Sep 16, 2011 at 2:37 PM, Aaron Cohen aa...@assonance.org wrote: Am I misunderstanding https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/ATransientSet.java#L32 ? Transient collections don't implement Associative (which extends IPersistentCollection and ILookup)

Re: misuse of or bug in transients?

2011-09-16 Thread David Nolen
On Fri, Sep 16, 2011 at 2:44 PM, Mark Engelberg mark.engelb...@gmail.comwrote: On Fri, Sep 16, 2011 at 11:20 AM, David Nolen dnolen.li...@gmail.comwrote: Examining the Java sources it looks like the transient collections do not support contains? by design. David Unfortunately, another

Re: Mocking out namespaces

2011-09-16 Thread Brian Hurt
On Thu, Sep 15, 2011 at 6:42 AM, Chris Perkins chrisperkin...@gmail.comwrote: On Wednesday, September 14, 2011 11:19:13 AM UTC-4, Brian Hurt wrote: Say I have two name spaces, A and B, with A depending on B. I want to test namespace A, replacing module B with a mock B for testing purposes-

Re: misuse of or bug in transients?

2011-09-16 Thread Herwig Hochleitner
Here is the (a?) ticket for this issue: http://dev.clojure.org/jira/browse/CLJ-700 I too have thought, it was fixed by now. Am Freitag, 16. September 2011 schrieb David Nolen : On Fri, Sep 16, 2011 at 2:37 PM, Aaron Cohen aa...@assonance.orgjavascript:_e({}, 'cvml', 'aa...@assonance.org');

Re: android / mobile help

2011-09-16 Thread Daniel Solano Gomez
On Fri Sep 16 10:24 2011, Raoul Duke wrote: hi, i dream of having a remote repl onto e.g. android so that i can try to reduce the write-push-run-test-debug-repeat cycle time. pretty please, does anybody have insights / experience / git hub forks / ideas about this? getting to a point where

Re: android / mobile help

2011-09-16 Thread Raoul Duke
On Fri, Sep 16, 2011 at 12:34 PM, Daniel Solano Gomez cloj...@sattvik.com wrote: source available, yet).  Due to how dynamic compilation occurs, it's slow (a few seconds), but it sure beats having to do an entire compile/deploy cycle. keen! -- You received this message because you are

Re: org.clojure:java.classpath 0.2.0 released

2011-09-16 Thread Stuart Sierra
Sorry, I don't know where to configure this in JIRA. Help? -Stuart Sierra -- 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

Re: misuse of or bug in transients?

2011-09-16 Thread David Nolen
On Fri, Sep 16, 2011 at 3:26 PM, Herwig Hochleitner hhochleit...@gmail.comwrote: Here is the (a?) ticket for this issue: http://dev.clojure.org/jira/browse/CLJ-700 I too have thought, it was fixed by now. The other thing to consider is that - is this a contract that is desirable to support?

Re: org.clojure:java.classpath 0.2.0 released

2011-09-16 Thread Chas Emerick
Fixed. It needed Default Permission Scheme = Clojure Permission Scheme. - Chas On Sep 16, 2011, at 3:42 PM, Stuart Sierra wrote: Sorry, I don't know where to configure this in JIRA. Help? -Stuart Sierra -- You received this message because you are subscribed to the Google Groups

Re: Mocking out namespaces

2011-09-16 Thread Stuart Sierra
On Friday, September 16, 2011 3:12:49 PM UTC-4, Brian Hurt wrote: How *should* I structure this code for testing? I was assuming the natural way to do this is to make A, B, and C separate name spaces but maybe this is wrong. The best way to make these namespaces testable, in my opinion,

Re: Mocking out namespaces

2011-09-16 Thread Chris Perkins
On Friday, September 16, 2011 3:12:49 PM UTC-4, Brian Hurt wrote: On Thu, Sep 15, 2011 at 6:42 AM, Chris Perkins chrispe...@gmail.comwrote: On Wednesday, September 14, 2011 11:19:13 AM UTC-4, Brian Hurt wrote: Say I have two name spaces, A and B, with A depending on B. I want to test

Re: misuse of or bug in transients?

2011-09-16 Thread Mark Engelberg
Support of membership testing is pretty much the defining characteristic of sets, transient or not. Transient sets already support membership testing in the form of (my-set item). If they support the IFn interface for membership testing, it's hard for me to imagine that it would be much more

Re: misuse of or bug in transients?

2011-09-16 Thread Herwig Hochleitner
Am Freitag, 16. September 2011 schrieb David Nolen : The other thing to consider is that - is this a contract that is desirable to support? Transients are only about performance - lowering the time it takes to construct a collection. Perhaps there are faster implementations which cannot

Re: misuse of or bug in transients?

2011-09-16 Thread David Nolen
On Fri, Sep 16, 2011 at 4:33 PM, Mark Engelberg mark.engelb...@gmail.comwrote: Support of membership testing is pretty much the defining characteristic of sets, transient or not. Transient sets already support membership testing in the form of (my-set item). If they support the IFn

Re: Mocking out namespaces

2011-09-16 Thread Brian Hurt
On Fri, Sep 16, 2011 at 4:28 PM, Chris Perkins chrisperkin...@gmail.comwrote: On Friday, September 16, 2011 3:12:49 PM UTC-4, Brian Hurt wrote: On Thu, Sep 15, 2011 at 6:42 AM, Chris Perkins chrispe...@gmail.comwrote: On Wednesday, September 14, 2011 11:19:13 AM UTC-4, Brian Hurt wrote:

Re: misuse of or bug in transients?

2011-09-16 Thread Herwig Hochleitner
Sorry! Disregard my former post. In fact, get doesn't work on transients either. Fingers too fast :/ Still, looking keys up in a map while building it, is a valid use case for transients, because you do that with persistent collections too. Same with sets. At the very least, get and contains?

Re: heaps in clojure

2011-09-16 Thread Jim Oly
Using PriorityQueue should give a good, fast result. Here's my implementation: (defn smallest-n [n xs] (let [q (java.util.PriorityQueue. xs)] (for [i (range n)] (.poll q (smallest-n 5 (shuffle (range 100))) ;; (0 1 2 3 4) Jim -- You received this message because you are subscribed

Re: including sound or image files with Leiningen uberjar command

2011-09-16 Thread willyh
Great. I can eliminate another function from my general purpose utilities file. Thanks. I need to comb the docs more. On Sep 16, 9:21 am, Dave Ray dave...@gmail.com wrote: Note that this implementation is the same as (clojure.java.io/resource) [1]. Dave

Re: heaps in clojure

2011-09-16 Thread Mark Engelberg
That's really no different from just sorting the list and taking the first 5. O(n log(n)). And for really large data sets, this is going to consume a lot of memory. The method I outlined would be O(n) and doesn't force the sequence to all be resident in memory at the same time. On Fri, Sep 16,

Re: Mocking out namespaces

2011-09-16 Thread Brian Hurt
On Fri, Sep 16, 2011 at 4:01 PM, Stuart Sierra the.stuart.sie...@gmail.comwrote: On Friday, September 16, 2011 3:12:49 PM UTC-4, Brian Hurt wrote: How *should* I structure this code for testing? I was assuming the natural way to do this is to make A, B, and C separate name spaces but maybe

Re: misuse of or bug in transients?

2011-09-16 Thread Herwig Hochleitner
Am Freitag, 16. September 2011 schrieb David Nolen : I suspect that part of the reason there is little movement on this is that transients are as of 1.3 *still* marked alpha. And from what I understand they will most likely become an implementation detail. That is direct use will be

Re: misuse of or bug in transients?

2011-09-16 Thread David Nolen
On Fri, Sep 16, 2011 at 5:12 PM, Herwig Hochleitner hhochleit...@gmail.comwrote: Am Freitag, 16. September 2011 schrieb David Nolen : I suspect that part of the reason there is little movement on this is that transients are as of 1.3 *still* marked alpha. And from what I understand they will

[1.3 RC0] extend-protocol doesn't compile for class expressions

2011-09-16 Thread Tassilo Horn
Hi all, I'd like to extend some protocol to objects of classes that were compiled in memory, and thus I don't have the class handy as literal but have to resolve it. To simplify the issue, my code is basically like this: --8---cut here---start-8---

Breaking change to core.logic

2011-09-16 Thread David Nolen
Hello all, I'll be changing core.logic so that logic variables are introduced w/ fresh and NOT exist. I'm loathe to make this change now but Daniel Friedman has a forthcoming paper on constraint logic programming with miniKanren (now clpKanren) and Friedman, Byrd, and Kiselyov have all agreed

small project to learn clojure

2011-09-16 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 hi community, i feel compelled to do something more complex in clojure. not too big, but bigger than what fits in 100 lines and offers some chances to use macros. it should also be fun, maybe something like robocode. - -- -BEGIN PGP

Re: misuse of or bug in transients?

2011-09-16 Thread Herwig Hochleitner
Am Freitag, 16. September 2011 schrieb David Nolen : I will note: It will probably not become an error because of the reasons I mentioned above and there is no reason to single out transients over all the other types that also return false. Thanks, I just was about to start a thread on dev

Re: Mocking out namespaces

2011-09-16 Thread Stuart Sierra
Brian Marick wrote Midje to support Clojure testing with a lot of mocking. May be worth a try: https://github.com/marick/Midje -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

Re: heaps in clojure

2011-09-16 Thread Joop Kiefte
Pepijn de Vos had a blogpost about lazy sorts. One of them seems to be a particularly good fit for this problem: http://pepijndevos.nl/lazy-sorting/index.html (the heap-sort example seems the fastest of those for this use-case...). Em sexta-feira, 16 de setembro de 2011, Mark Engelberg escreveu:

Re: heaps in clojure

2011-09-16 Thread Mark Engelberg
That heap-sort example is not really lazy. The java.util.concurrent.PriorityBlockingQueue essentially sorts the whole thing, and then the heap-sort is just making a lazy seq over that. Also, note that the speed test at that link is only working with lists of 1000, and the original poster

Re: misuse of or bug in transients?

2011-09-16 Thread Ken Wesson
IMO, get and contains? should work on transients. If the fn-call variant of get works, the others can for transients be defined in terms of that. Add containsKey to ITransientAssociative and implement containsKey on transient sets and maps to do what calling them as functions does, and the problem

Re: small project to learn clojure

2011-09-16 Thread Alan Malloy
Notice something you do often, and try to automate it. Or find an open- source project you use, and you wish were better in some way, and improve it. Learning a language by means of I need to learn something, what should I do is not as effective, or as fun, as learning it by doing something you

Re: including sound or image files with Leiningen uberjar command

2011-09-16 Thread loonster
On Sep 16, 1:24 am, Joost jo...@zeekat.nl wrote: On Sep 16, 7:20 am, loonster tbur...@acm.org wrote: Sound or image files will show up in the resulting uberjar if they reside in a /resources subdirectory of a Leiningen home project directory.  I can't find any documentation for how to