Re: let-else macro

2011-12-07 Thread Evan Gamble
Thanks for your comment, Sam. Before you posted the comment, Peter Danenberg had asked if I would modify let-else to include the behavior of your let? macro. Your comment and his request have spurred me to action. I've modified the macro to accept optional :when pred and :else expr clauses after

Re: Building Clojure applications w/ Maven

2011-12-07 Thread Riccardo
The error shown in Ubuntu, when I try to execute the jar file, is: Failed to load Main-Class manifest attribute from '...demo.jar' I suppose I am missing something in the main structure... This is the pom: project xmlns=http://maven.apache.org/POM/4.0.0; xmlns:xsi=http://

Re: swank-cdt: Using Slime with the Clojure Debugging Toolkit

2011-12-07 Thread Young Kim
The following is the file lists in clojure-clojure-source-1.3.0- alpha5.jar on Windows 7. As you can see, there are no *.clj files in clojure-clojure- source-1.3.0-alpha5.jar. So I think that it is natural that 'clojure/set.clj - source not found.' message appeared. Do I misunderstand anything?

Re: swank-cdt: Using Slime with the Clojure Debugging Toolkit

2011-12-07 Thread Young Kim
I posted the related problem on https://github.com/technomancy/swank-clojure/issues/86 Please refer to it! I hope that it will be helpful for you. On Dec 7, 12:47 pm, Andrew ache...@gmail.com wrote: Thanks for taking the time Sean! You're right...    - I'm on Windows XP    - I had to copy

Re: Building Clojure applications w/ Maven

2011-12-07 Thread Matteo Moci
leiningen has a target you can call like this: lein pom maybe setting up a fake simple lein project you can watch how the generated pom is different from yours. On Wed, Dec 7, 2011 at 1:32 PM, Riccardo riccardo.novie...@gmail.com wrote: The error shown in Ubuntu, when I try to execute the jar

Clojure/West registration open - San Jose - Mar 16-17

2011-12-07 Thread Alex Miller
Hello all, If you're interested in Clojure/West (http://clojurewest.org, San Jose, Mar 16-17 or training Mar 12-15), you can now: - Submit a talk: http://clojurewest.org/call-for-presentations/ - Register for the conference: http://www.regonline.com/clojurewest2012 - Early bird - $450 until

Re: Surprising behavior with clojure.core/int (and probably other primitive integer functions)

2011-12-07 Thread Ben Smith-Mannschott
Would it help to have a naming convention for Clojure to distinguish compile-time flags from normal dynamic vars? // ben On Tue, Dec 6, 2011 at 17:05, David Nolen dnolen.li...@gmail.com wrote: *unchecked-math* is a compiler flag. On Tue, Dec 6, 2011 at 7:00 AM, Cedric Greevey

Re: let-else macro

2011-12-07 Thread Stephen Compall
On Tue, 2011-12-06 at 19:13 -0800, Sam Ritchie wrote: (let [x (foo) y (bar)] (when y (let [ ] ))) that check jarred me, so I put this together: https://gist.github.com/1347312. On reflection, discomfort with indentation levels probably isn't near the

Re: Building Clojure applications w/ Maven

2011-12-07 Thread Stephen Compall
On Wed, 2011-12-07 at 13:41 +0200, Matteo Moci wrote: lein pom maybe setting up a fake simple lein project you can watch how the generated pom is different from yours. Unfortunately, that pom is too fake to be useful as a comparison tool. -- Stephen Compall ^aCollection allSatisfy:

Dynamically Loading Jar Strategy

2011-12-07 Thread Pierre-Yves Ritschard
Hi, I have a use case where a daemon needs to read full namespaces from an external jar. I can successfuly access the namespace in the jar with tools.namespace/ find-namespaces-in-jarfile, then from the jarfile, selecting appropriate entries, coercing into readers and then loading with load-

Re: getting inside another dynamic scope?

2011-12-07 Thread Andrew
(Sorry, I'll read this first http://clojure.org/vars#Vars%20and%20the%20Global%20Environment) -- 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

Re: let-else macro

2011-12-07 Thread Marshall T. Vandegrift
Stephen Compall stephen.comp...@gmail.com writes: And may be anyway further generalized: (defmacro - [ forms] `(- ~@(reverse forms))) (- (let [x (foo) y (bar)]) (when y) (let [ ]) (do )) Another alternative, (require '[clojure.algo.monads :as m]) (m/domonad

Re: let-else macro

2011-12-07 Thread Peter Danenberg
Thanks, Evan; I had a use-case where the truthiness of nil would have forced me out of `let-else.' This new predicate-abstraction is beautiful. Quoth Evan Gamble on Sweetmorn, the 49th of The Aftermath: Thanks for your comment, Sam. Before you posted the comment, Peter Danenberg had asked if

AOT compilation for library targeting multiple Clojure versions

2011-12-07 Thread Sam Ritchie
Hey all, I'm almost finished integration Kryo serialization into Cascalog using Alex Miller's Carbonite library, and I'm running into a bit of a hitch with AOT-compilation. I'm exposing the Clojure serializers to Kryo using a namespace compiled with :gen-class:

Re: AOT compilation for library targeting multiple Clojure versions

2011-12-07 Thread Meikel Brandmeyer (kotarak)
Hi, I found the easiest approach to be a small wrapper written in Java. Something like this should work. Not tested, though. package carbonite; import clojure.lang.RT; import clojure.lang.Var; import com.esotericsoftware.kryo.Kryo; public class JavaBridge { static Var require =

Re: Literate Programming in Emacs?

2011-12-07 Thread Robert McIntyre
Here's a pew literate programs I've written, as well as the website on which they are hosted. http://hg.bortreb.com/abomination/ http://hg.bortreb.com/aurellem/ http://hg.bortreb.com/cortex/ http://www.aurellem.com I use some emacs scripts to automate tangling and weaving.

NW UK Clojurians?

2011-12-07 Thread Simon Holgate
Hi, anyone out there in the NW of the UK? I'm in Liverpool and pondering a NW Meetup. Any takers? Simon -- 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

Re: Keeping an SSH tunnel open on Heroku using Clojure

2011-12-07 Thread Dave Barker
FYI I've improved my example https://gist.github.com/1443579 in case anyone needs it, not tested it on Heroku yet though. Cheers, Dave. -- 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

Re: Get multiple vals from a map

2011-12-07 Thread vitalyper
Thanks, Alan. It is more general solution which also works for keys that are not keywords user= (map {a 1 b 2 c 3} [ a b]) (1 2) On Dec 1, 5:02 pm, Alan Malloy a...@malloys.org wrote: I usually use juxt, but a more correct/robust solution is to use map, with the lookup-map as the function:

Re: swank-cdt: Using Slime with the Clojure Debugging Toolkit

2011-12-07 Thread George Jahad
I think you are right Sean. This is a problem on Windows with the file separator. Aravindh Johendran suggested a fix a while ago. Let me try integrating it and see if that doesn't fix the windows platform. I'll let you know when I have something. On Dec 6, 4:36 pm, Sean Corfield

Re: swank-cdt: Using Slime with the Clojure Debugging Toolkit

2011-12-07 Thread George Jahad
On Dec 6, 11:05 pm, Young Kim philo...@gmail.com wrote: The following is the file lists in clojure-clojure-source-1.3.0- alpha5.jar on Windows 7. As you can see, there are no *.clj files in clojure-clojure- source-1.3.0-alpha5.jar. So I think that it is natural that 'clojure/set.clj -

Re: swank-cdt: Using Slime with the Clojure Debugging Toolkit

2011-12-07 Thread George Jahad
Thanks very much for this bug report Young! I'm going to summarize your findings here for everyone else. Basically, you found 3 problems: 1. The set-bp command requires full name-space qualification of the function name. 2. On Windows, if attach.dll isn't on the java-library path, you get the

Re: AOT compilation for library targeting multiple Clojure versions

2011-12-07 Thread Sam Ritchie
Meikel, thanks so much for this. I followed your advicehttps://github.com/sritchie/carbonite/blob/master/src/jvm/carbonite/JavaBridge.javaand Cascalog and Carbonite are now working Clojures 1.2, 1.3 and 1.4 :) Cheers, Sam On Wed, Dec 7, 2011 at 8:17 AM, Meikel Brandmeyer (kotarak)

Re: Dynamically Loading Jar Strategy

2011-12-07 Thread vitalyper
You can add jar to a classpath at runtime via the hack below. http://groups.google.com/group/clojure/browse_thread/thread/95ea6e918c430e/69c0d195defeeed3?lnk=gstq=classpath#69c0d195defeeed3 HTH On Dec 7, 10:26 am, Pierre-Yves Ritschard p...@spootnik.org wrote: Hi, I have a use case where a

Re: Dynamically Loading Jar Strategy

2011-12-07 Thread Pierre-Yves Ritschard
I ended up doing that, all the other approaches fail for me. Thanks for the confirmation. On Wed, Dec 7, 2011 at 8:12 PM, vitalyper vitaly...@yahoo.com wrote: You can add jar to a classpath at runtime via the hack below.

Re: Dynamically Loading Jar Strategy

2011-12-07 Thread Stuart Sierra
Also check out https://github.com/cemerick/pomegranate -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

Re: Dynamically Loading Jar Strategy

2011-12-07 Thread Kevin Downey
try something like https://github.com/hiredman/clojurebot/blob/master/src/clojurebot/plugin.clj On Wed, Dec 7, 2011 at 11:53 AM, Pierre-Yves Ritschard p...@spootnik.org wrote: I ended up doing that, all the other approaches fail for me. Thanks for the confirmation. On Wed, Dec 7, 2011 at

Re: getting inside another dynamic scope?

2011-12-07 Thread Stuart Sierra
Clojure doesn't provide any mechanism to peek inside other threads. Dynamic Var bindings create java.lang.ThreadLocal objects to store the temporary bindings. A Java debugger or IDE *might* let you look at those. -S -- You received this message because you are subscribed to the Google Groups

Re: AOT compilation for library targeting multiple Clojure versions

2011-12-07 Thread Stuart Sierra
This is a well-known issue. Some workarounds and potential fixes here: http://dev.clojure.org/display/design/Transitive+AOT+Compilation -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

Re: Building Clojure applications w/ Maven

2011-12-07 Thread Stuart Sierra
Adding the Main-Class attribute to a JAR manifest is handled, in Maven, by the Assembly Plugin. See here for examples: http://maven.apache.org/plugins/maven-assembly-plugin/usage.html -S -- You received this message because you are subscribed to the Google Groups Clojure group. To post to

Re: no :main namespace specified in project.clj

2011-12-07 Thread Stuart Sierra
`lein run` expects the project.clj file to specify a namespace that contains the main function used to start the program. It usually looks like this: https://github.com/technomancy/leiningen/blob/07a755c8afe936ec904ea455659dadf8aae1ae88/sample.project.clj#L95 See

Re: Building Clojure applications w/ Maven

2011-12-07 Thread Riccardo
That Stuart Sierra? I am a fan of you :) and I have bought Practical Clojure (but not read much yet). Thanks, I'll try that solution! On Dec 7, 8:13 pm, Stuart Sierra the.stuart.sie...@gmail.com wrote: Adding the Main-Class attribute to a JAR manifest is handled, in Maven, by the Assembly

Re: Building Clojure applications w/ Maven

2011-12-07 Thread Alex Ott
Hi had you seen my article on Clojure/Maven? (http://alexott.net/en/clojure/ClojureMaven.html) P.S. and you can look onto following project (https://github.com/alexott/clojure-examples/tree/master/compojure-simple) that uses multi-project maven setup On Tue, Dec 6, 2011 at 11:35 PM, Riccardo

Re: Dynamically Loading Jar Strategy

2011-12-07 Thread Pierre-Yves Ritschard
Thanks a lot for the good advice. Pomegranate is very nice and very useful for testing. As for your trick Kevin, certainly nicer that the reflection mess. On Wed, Dec 7, 2011 at 9:00 PM, Kevin Downey redc...@gmail.com wrote: try something like

Re: Building Clojure applications w/ Maven

2011-12-07 Thread Riccardo
Right I am finally getting closer: the generated jar finally works, but it still gives a message A java exception has occurred My code (not really mine...) look like this: - (ns

Re: Building Clojure applications w/ Maven

2011-12-07 Thread Riccardo
Oh sorry it is fine now: it's just because there is no output to print with the last script print(code sample) , after deleting it, the jar is working fine. Thanks again. If somebody else will need more information, the steps to compile this project were: Easy AOT Compile with NetbeansMaven 1-

Re: Dynamically Loading Jar Strategy

2011-12-07 Thread Brent Millare
To better understand what's going underneath, you're just calling the addURL method of the classloader. But since you might be evaluating this at the repl, there is an important point regarding the classloader. Everytime clojure evaluates a form, it will use a new classloader on that form, and

Macro to ease multiple-key sorting

2011-12-07 Thread Andy Fingerhut
I've been going through the PLEAC web site, writing Clojure examples corresponding to the Perl code examples from the Perl Cookbook: http://pleac.sourceforge.net Michael Bacarella started a github repo to collect these together, and I'm helping flesh some of them out.

Re: clojurescript on windows (how create goog.jar)...Noob question

2011-12-07 Thread bjconlan
Yes, I imagine that bootstrapping on windows isn't the funnest process. Life might become easier if you installed the windows services for unix or cygwin/msys or the like and call the script/ bootstrap file. but just to clarify the structure of the lib folder should be as follows (if following

Re: Macro to ease multiple-key sorting

2011-12-07 Thread Alan Malloy
This should be a function, not a macro. In fact it is just: (defn multicmp [ xs] (first (remove zero? xs))) But what you really wanted to begin with is a comparator function, so more like: (defn multicmp [ keys] (fn [a b] (or (first (remove zero? (map #(compare (% a) (% b))

Re: Macro to ease multiple-key sorting

2011-12-07 Thread Andy Fingerhut
The intent of making it a macro is that it allows short-circuit evaluation, like Clojure's or/and. There is no reason to evaluate comparisons between keys when an earlier comparison has already decided the ordering. Hardwiring in the compare function and the order between %1 and %2 is an

Re: thank you, clojure hackers

2011-12-07 Thread Craig Brozefsky
Ambrose Bonnaire-Sergeant abonnaireserge...@gmail.com writes: What are you making? Malware behavior analysis tool. I'll be able to release most of the non-malware specific portions once this gets out of the proof of concept phase. -- Craig Brozefsky cr...@red-bean.com Premature reification

Re: Macro to ease multiple-key sorting

2011-12-07 Thread Andy Fingerhut
Ugh. And if I were slightly lazier at pressing the send button, I would have realized that the laziness of map and remove gives this short-circuit evaluation. I generalized your example to allow the notation [- keyfn] as an argument to specify descending order on that key, instead of ascending

Re: Macro to ease multiple-key sorting

2011-12-07 Thread Alan Malloy
On Dec 7, 8:12 pm, Andy Fingerhut andy.finger...@gmail.com wrote: Ugh.  And if I were slightly lazier at pressing the send button, I would have realized that the laziness of map and remove gives this short-circuit evaluation. I generalized your example to allow the notation [- keyfn] as an

Re: Macro to ease multiple-key sorting

2011-12-07 Thread Andy Fingerhut
On Wed, Dec 7, 2011 at 8:29 PM, Alan Malloy a...@malloys.org wrote: On Dec 7, 8:12 pm, Andy Fingerhut andy.finger...@gmail.com wrote: Ugh. And if I were slightly lazier at pressing the send button, I would have realized that the laziness of map and remove gives this short-circuit

Re: Macro to ease multiple-key sorting

2011-12-07 Thread Alan Malloy
On Dec 7, 9:23 pm, Andy Fingerhut andy.finger...@gmail.com wrote: On Wed, Dec 7, 2011 at 8:29 PM, Alan Malloy a...@malloys.org wrote: On Dec 7, 8:12 pm, Andy Fingerhut andy.finger...@gmail.com wrote: Ugh.  And if I were slightly lazier at pressing the send button, I would have realized

Re: Quartz and Clojure

2011-12-07 Thread Lars Rune Nøstdal
You've probably found this by now, but there's: https://github.com/mdpendergrass/quartz-clj -- 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 -

re-def a non-dynamic var to a ^:dynamic var make a mistake

2011-12-07 Thread zhi zhu
Hi,everyone! I'm a newbie here.When I'm reading Mark Volkmann's Tutorial,i make a mistake by binding a non-dynamic var 'x' to new value.Then I def 'x' with ^:dynamic again,but in this line (binding [x 9] (foo)), the function 'foo' ignore the binding.Why? Thanks for reply!!! uer= (def x 0)

Re: re-def a non-dynamic var to a ^:dynamic var make a mistake

2011-12-07 Thread Meikel Brandmeyer (kotarak)
Hi, just a guess: ^:dynmamic is a compile-time thing. foo was compiled without it in place, so the compiler didn't consider it. Recompile foo after the re-def with ^:dynamic and it should honor the setting. Sincerely Meikel -- You received this message because you are subscribed to the