Re: Clojure Performance For Expensive Algorithms
On Thursday, February 21, 2013 10:49:42 PM UTC+1, David Nolen wrote: On Thu, Feb 21, 2013 at 4:55 AM, Marko Topolnik marko.t...@gmail.comjavascript: wrote: Whatever the final performance achieved, the fact remains that the original Java code was much cleaner, simpler, and more comprehensible than the big ball of mud the performant Clojure version is turning into. To my eyes the deftype version is about as clean, simple, comprehensible, as the Java version. But I've been doing Clojure for a while now. My 5-year experience with Clojure (since 0.9) hasn't helped me to see it that way. Christophe's version also has the advantage that it can pretty much compile down to efficient JavaScript via ClojureScript and probably an efficient ClojureCLR program as well. This may or may not matter to you. In a Java project it clearly does not matter. In library code it quite likely could matter a lot. That is of course a subject completely separate from the discussion on the pitfalls involved in getting Clojure performance right. Apparently even Cristophe broke quite a bit of sweat to come up with his second solution, and did also wander around searching for bottlenecks (like .equals against =). ^:unsynchronized-mutable is something I've never layed my eyes on before and I've spent quite a bit of time working on optimized Clojure, googling for any trick I could find. What is the most trivially obvious way to solve a probelm in Java takes the most obscure features of Clojure to emulate. Finally, Cristophe's solution, as well as all other optimized Clojure code, seems to be just barely making it for the use case involved. In my code, for example, I struggle with such things as an array of Strings (received from a Java method) failing when used in amap, which needs an array of Objects. I'm sure I could come up with yet another layer of obscurity which would make this work, but, as I said, after several months of struggling I'm ready to settle for 100 lines of clean, elegant, obvious Java. -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Module For COM Objects
You can also use jawin. For example: (ns reports.pdf (:import org.jawin.DispatchPtr org.jawin.win32.Ole32)) (defn merge-pdfs Combines all the input-files into a single output-file. [input-files output-file] (Ole32/CoInitialize) (let [app (DispatchPtr. AcroExch.App) doc1 (DispatchPtr. AcroExch.PDDoc) doc2 (DispatchPtr. AcroExch.PDDoc)] (.invoke doc1 Open (first input-files)) (doseq [input (rest input-files)] (.invoke doc2 Open input) (let [pages1 (.invoke doc1 GetNumPages) pages2 (.invoke doc2 GetNumPages)] (.invokeN doc1 InsertPages (to-array [(- pages1 1) doc2 0 pages2 true]))) (.invoke doc2 Close)) (.invoke doc1 Save 1 output-file) ;;PDSaveFull=1 (.invoke doc1 Close) (.invoke app Exit) (.close app)) (Ole32/CoUninitialize)) On Feb 22, 12:53 am, octopusgrabbus octopusgrab...@gmail.com wrote: Does Clojure have a module that allows initializing, passing data to, and finalizing COM objects? I am asking, because I need to write a Clojure program to communicate with a COM toolkit. Thanks. -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
ANN: Lambda Jam - July 8-10 - Chicago
Lambda Jam (http://lambdajam.com) is a new conference for commercial functional programmers, specifically languages like Erlang, Clojure, Scala, Haskell, F#, etc. Lambda Jam will take place in Chicago July 8-10 and will feature a new format: sessions in the morning, workshops and jams in the afternoon, closing with a keynote. This is a *hands-on* learning conference! Key items: * Call for Presentations closes March 29th - http://lambdajam.com/cfp (travel and hotel is covered, see CFP for details). Please send us your talks! * Program (as it develops) - http://lambdajam.com/sessions * Sponsorship Prospectus available now - http://lambdajam.com/sponsorship - this is a great way to get your company name in front of 300+ functional programmers! I am really excited to announce our keynote speakers for Lambda Jam: * Gerald Sussman - professor at MIT, co-author of Structure and Interpretation of Computer Programs, and co-inventor of Scheme * Joe Armstrong - inventor of Erlang * David Nolen - developer at the New York Times, creator of core.logic port of miniKanren to Clojure, and ClojureScript developer Registration is not open yet but will be coming soon (probably about $400). If you're interested in tracking developments: * Track on Lanyrd - http://lanyrd.com/2013/lambda-jam/ * Join the mailing list - http://eepurl.com/n0iXv Hope you can make it! - Alex Miller (@puredanger) -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: documentation for clojure core extension points - multimethods and protocols?
I guess you should just grep clojure core source for defprotocol, defmulti and so on. -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Redefinition of datatypes
I have,'t looked much into it but my hunch is that it's the same bytecode but loaded by two different classloaders. So a double loading rather than a double compilation. Christophe On Fri, Feb 22, 2013 at 8:26 AM, Ambrose Bonnaire-Sergeant abonnaireserge...@gmail.com wrote: Hi, I don't understand why this `assert` fails when the namespace is compiled with `compile`. It seems like the datatype A is being compiled twice. (ns mvn-test.core) (deftype A []) (assert (= (class (A.)) (class ((fn [] (A.)) user= (compile 'mvn-test.core) CompilerException java.lang.AssertionError: Assert failed: (= (class (A.)) (class ((fn [] (A.), compiling:(core.clj:5:1) Here is the project.clj: (defproject mvn-test 0.0.1-SNAPSHOT :source-paths [src/main/clojure] :dependencies [[org.clojure/clojure 1.5.0-RC16]]) I found this behaviour was the root cause of why `mvn test` fails in core.typed, while `lein test` works perfectly. Any pointers would be appreciated. Thanks, Ambrose -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- On Clojure http://clj-me.cgrand.net/ Clojure Programming http://clojurebook.com Training, Consulting Contracting http://lambdanext.eu/ -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Clojure Performance For Expensive Algorithms
Marko Topolnik marko.topol...@gmail.com writes: Christophe's version also has the advantage that it can pretty much compile down to efficient JavaScript via ClojureScript and probably an efficient ClojureCLR program as well. This may or may not matter to you. Apparently even Cristophe broke quite a bit of sweat to come up with his second solution, and did also wander around searching for bottlenecks (like .equals against =). ^:unsynchronized-mutable is something I've never layed my eyes on before and I've spent quite a bit of time working on optimized Clojure, googling for any trick I could find. What is the most trivially obvious way to solve a probelm in Java takes the most obscure features of Clojure to emulate. What is interesting, though, it that it's not clear yet why this is the case. What is clojure doing that is slow. Phil -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Clojure Performance For Expensive Algorithms
Perhaps it's time to hit the decompiler :) AOT compile and apply javap; do the same for a comparable Java version. This will be a time-consuming and frustrating experience and it won't bring you lasting insight into performant Clojure because things will change around in the next release. On Friday, February 22, 2013 12:53:29 PM UTC+1, Phillip Lord wrote: Apparently even Cristophe broke quite a bit of sweat to come up with his second solution, and did also wander around searching for bottlenecks (like .equals against =). ^:unsynchronized-mutable is something I've never layed my eyes on before and I've spent quite a bit of time working on optimized Clojure, googling for any trick I could find. What is the most trivially obvious way to solve a probelm in Java takes the most obscure features of Clojure to emulate. What is interesting, though, it that it's not clear yet why this is the case. What is clojure doing that is slow. Phil -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: a bit mystified by unchecked-multiply
So, something like: (type 23) the reader makes a list of a symbol and a primitive, the evaluator evals to get a generic function and a primitive, then tries to apply the generic function to the primitive, can't find a primitive version, so boxes the primitive to an object and tries again, and then finds that there is a specific type function that takes long objects and applies that? (i.e. type isn't lying, but the evaluator is deceiving it) Are there any docs for this or any way to trace the process? How would I work out what's going on in a given case? On Thursday, February 21, 2013 6:59:33 PM UTC, Herwig Hochleitner wrote: Both are true. The type function doesn't have a primitive version, so its argument gets auto-boxed. -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: documentation for clojure core extension points - multimethods and protocols?
I did this. There are actually not many protocols. Likely because most of the original underlying implementation in terms of java interfaces. Few multi-methods beyond print-method stood out. I can post the output if anyone is interested. Dave On Friday, 22 February 2013 21:51:06 UTC+11, Andrew Sernyak wrote: I guess you should just grep clojure core source for defprotocol, defmulti and so on. -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: documentation for clojure core extension points - multimethods and protocols?
Please do post :) On Feb 22, 2013 7:08 PM, Ambrose Bonnaire-Sergeant abonnaireserge...@gmail.com wrote: Yes please. On Fri, Feb 22, 2013 at 9:37 PM, Dave Sann daves...@gmail.com wrote: I did this. There are actually not many protocols. Likely because most of the original underlying implementation in terms of java interfaces. Few multi-methods beyond print-method stood out. I can post the output if anyone is interested. Dave On Friday, 22 February 2013 21:51:06 UTC+11, Andrew Sernyak wrote: I guess you should just grep clojure core source for defprotocol, defmulti and so on. -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: documentation for clojure core extension points - multimethods and protocols?
This is for 1.4.0. Multi methods. (Filenames come after) (the two methods in dispatch are: simple-dispatch, code-dispatch add -A 1 option to the grep to see this) $ find . -name *.clj -exec grep defmulti \{\} \; -print -printf \n (defmulti (defmulti ./src/clj/clojure/pprint/dispatch.clj (defmulti ^{:private true} write-token #(:type-tag %2)) (defmulti ^{:private true} emit-nl? (fn [t _ _ _] (:type t))) (defmulti ^{:private true} tok :type-tag) ./src/clj/clojure/pprint/pretty_writer.clj (defmulti ./src/clj/clojure/java/io.clj (defmacro defmulti (throw (Exception. The syntax for defmulti has changed. Example: (defmulti name dispatch-fn :default dispatch-value (defmulti print-method (fn [x writer] (defmulti print-dup (fn [x writer] (class x))) ./src/clj/clojure/core.clj (defmulti is-leaf collection-tag) (defmulti get-child (fn [parent index] (collection-tag parent))) (defmulti get-child-count collection-tag) (defmulti list-provider class) (defmulti table-model class) ./src/clj/clojure/inspector.clj (defmulti ^:dynamic junit-report :type) ./src/clj/clojure/test/junit.clj (defmulti ^:dynamic tap-report (fn [data] (:type data))) ./src/clj/clojure/test/tap.clj (defmulti (defmulti assert-expr (defmulti use-fixtures ./src/clj/clojure/test.clj (defmulti ./test/clojure/test_clojure/pprint/test_pretty.clj ; defmulti ./test/clojure/test_clojure/multimethods.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 - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: documentation for clojure core extension points - multimethods and protocols?
1.4.0 protocols $ find . -name *.clj -exec grep defprotocol \{\} \; -print -printf \n (defprotocol Reflector (defprotocol TypeReference ./src/clj/clojure/reflect.clj (defprotocol ClassResolver ./src/clj/clojure/reflect/java.clj (defprotocol ^{:added 1.2} Coercions (defprotocol ^{:added 1.2} IOFactory ./src/clj/clojure/java/io.clj (defprotocol ^{:added 1.3} EqualityPartition (defprotocol ^{:added 1.3} Diff ./src/clj/clojure/data.clj (defmacro defprotocol (defprotocol AProtocolName Java parlance). defprotocol is dynamic, has no special compile-time defprotocol will automatically generate a corresponding interface, (defprotocol P ./src/clj/clojure/core_deftype.clj (defprotocol CollReduce (defprotocol InternalReduce (defprotocol IKVReduce ./src/clj/clojure/core/protocols.clj (defprotocol HintedProtocol ./test/clojure/test_clojure/compilation.clj (eval '(defprotocol Elusive (old-method [x]))) (eval '(defprotocol Elusive (new-method [x]))) (defprotocol SyntaxQuoteTestProtocol ./test/clojure/test_clojure/protocols.clj (defprotocol TestProtocolA (defprotocol TestProtocolB ./test/clojure/test_clojure/protocols/hash_collisions.clj (defprotocol ExampleProtocol ./test/clojure/test_clojure/protocols/examples.clj (defprotocol SimpleProtocol ./test/clojure/test_clojure/protocols/more_examples.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 - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: a bit mystified by unchecked-multiply
The reader always returns objects, it's the compiler that sometimes decides to unbox literal numbers. As for type, it's just a regular Clojure function which takes a single object argument (so the 23 will be passed to it in a Long box). Here it happens to delegate to class and ultimately (.getClass (Long. 23)). Cheers, M. On 22 February 2013 14:19, John Lawrence Aspden aspd...@googlemail.com wrote: So, something like: (type 23) the reader makes a list of a symbol and a primitive, the evaluator evals to get a generic function and a primitive, then tries to apply the generic function to the primitive, can't find a primitive version, so boxes the primitive to an object and tries again, and then finds that there is a specific type function that takes long objects and applies that? (i.e. type isn't lying, but the evaluator is deceiving it) Are there any docs for this or any way to trace the process? How would I work out what's going on in a given case? On Thursday, February 21, 2013 6:59:33 PM UTC, Herwig Hochleitner wrote: Both are true. The type function doesn't have a primitive version, so its argument gets auto-boxed. -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Clojure Performance For Expensive Algorithms
I'd look at it the other way around. It would be good if someone did this, so that it would change around in the next release, and I won't have to have any lasting insight into the performant Clojure. I wasn't the OP, BTW, although I suspect he and I share a profession. String matching algorithms are things I would like to work and would like to work quickly. But I'd like not to have to code them; hence the interest in the thread. Phil Marko Topolnik marko.topol...@gmail.com writes: Perhaps it's time to hit the decompiler :) AOT compile and apply javap; do the same for a comparable Java version. This will be a time-consuming and frustrating experience and it won't bring you lasting insight into performant Clojure because things will change around in the next release. On Friday, February 22, 2013 12:53:29 PM UTC+1, Phillip Lord wrote: Apparently even Cristophe broke quite a bit of sweat to come up with his second solution, and did also wander around searching for bottlenecks (like .equals against =). ^:unsynchronized-mutable is something I've never layed my eyes on before and I've spent quite a bit of time working on optimized Clojure, googling for any trick I could find. What is the most trivially obvious way to solve a probelm in Java takes the most obscure features of Clojure to emulate. What is interesting, though, it that it's not clear yet why this is the case. What is clojure doing that is slow. Phil -- -- Phillip Lord, Phone: +44 (0) 191 222 7827 Lecturer in Bioinformatics, Email: phillip.l...@newcastle.ac.uk School of Computing Science, http://homepages.cs.ncl.ac.uk/phillip.lord Room 914 Claremont Tower, skype: russet_apples Newcastle University, twitter: phillord NE1 7RU -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: a bit mystified by unchecked-multiply
There is no evaluator in clojure (other than the one in the JVM) and certainly no retries. Clojure is a compiled language. All regular function are called via the IFn interface, which takes objects. Function arguments and return values can be type hinted to be primitive. Normally such primitives are auto (un)boxed. If the type inferencer sees you passing a primitive value into a primitive argument, the boxing/unboxing is omitted. type is not hinted at all, so its arguments must always be Objects. In general, you can think of primitive values in clojure as an ephemeral construct, that only lasts as long as there is a binding that can take it. 2013/2/22 John Lawrence Aspden aspd...@googlemail.com So, something like: (type 23) the reader makes a list of a symbol and a primitive, the evaluator evals to get a generic function and a primitive, then tries to apply the generic function to the primitive, can't find a primitive version, so boxes the primitive to an object and tries again, and then finds that there is a specific type function that takes long objects and applies that? (i.e. type isn't lying, but the evaluator is deceiving it) Are there any docs for this or any way to trace the process? How would I work out what's going on in a given case? On Thursday, February 21, 2013 6:59:33 PM UTC, Herwig Hochleitner wrote: Both are true. The type function doesn't have a primitive version, so its argument gets auto-boxed. -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Clojure Performance For Expensive Algorithms
That would exactly be my point, too: I want to write idiomatic Clojure and have the underlying runtime make it perform; that's what I get with Java. I don't want to twist the compiler's arm into producing the bytecode that I can get from straightforward Java code. Incidentally, it happens that the piece of code that I have mentioned is also about heavy string matching. On Friday, February 22, 2013 3:33:55 PM UTC+1, Phillip Lord wrote: I'd look at it the other way around. It would be good if someone did this, so that it would change around in the next release, and I won't have to have any lasting insight into the performant Clojure. I wasn't the OP, BTW, although I suspect he and I share a profession. String matching algorithms are things I would like to work and would like to work quickly. But I'd like not to have to code them; hence the interest in the thread. Phil Marko Topolnik marko.t...@gmail.com javascript: writes: Perhaps it's time to hit the decompiler :) AOT compile and apply javap; do the same for a comparable Java version. This will be a time-consuming and frustrating experience and it won't bring you lasting insight into performant Clojure because things will change around in the next release. On Friday, February 22, 2013 12:53:29 PM UTC+1, Phillip Lord wrote: Apparently even Cristophe broke quite a bit of sweat to come up with his second solution, and did also wander around searching for bottlenecks (like .equals against =). ^:unsynchronized-mutable is something I've never layed my eyes on before and I've spent quite a bit of time working on optimized Clojure, googling for any trick I could find. What is the most trivially obvious way to solve a probelm in Java takes the most obscure features of Clojure to emulate. What is interesting, though, it that it's not clear yet why this is the case. What is clojure doing that is slow. Phil -- -- Phillip Lord, Phone: +44 (0) 191 222 7827 Lecturer in Bioinformatics, Email: philli...@newcastle.ac.ukjavascript: School of Computing Science, http://homepages.cs.ncl.ac.uk/phillip.lord Room 914 Claremont Tower, skype: russet_apples Newcastle University, twitter: phillord NE1 7RU -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Automatically looking up and adding dependencies
Hi, I made a thing: https://github.com/AdamClements/latest-clojure-libraries It's an emacs command which when you do M-x insert-latest-clojure-library will ask you for the name of a library on clojars. It will then pull the clojars page, look at the latest version and insert the text e.g. [congomongo 0.4.0] into your buffer (usually you'd go to your project.clj, make a gap in your dependencies then run this command and it'll insert in place). It will then ask you if you want to add it to the classpath of your running repl (requires you to have pomegranate in your profiles.clj dependencies map). Bingo, latest version of the library in your project.clj and your running nrepl, no restarts required. Issues: It just pulls the clojars page and runs a nasty regex over it (bleurgh). I tried to use the lein search indices, but it keeps breaking on my machine and the output isn't ideal. Perhaps if people find this useful, someone could help me fix up lein search to work for this use case (only interested in latest version and closest match). The other advantage of that would be that it then searches repositories other than clojars, which would be nice. Anyway, have a play and let me know what you think, Adam -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[ANN] clj-elasticsearch, a native wrapper for Elasticsearch
clj-elasticsearch is a fast and complete Clojure wrapper around the native Java Elasticsearch library. It allows some nifty things such as embedding the server directly inside your app, and is extensively documented. You can find some explanations on how and why the library was build at http://theblankscreen.net/blog/2013/02/22/first-public-release-of-clj-elasticsearch/ and get the code here: https://github.com/ngrunwald/clj-elasticsearch. As always, questions, remarks, bugs report and patches are more than welcome! -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Clojure Performance For Expensive Algorithms
On Fri, Feb 22, 2013 at 3:43 AM, Marko Topolnik marko.topol...@gmail.comwrote: My 5-year experience with Clojure (since 0.9) hasn't helped me to see it that way. I've been doing Clojure for about 5 years as well. Optimizing Clojure in the early days was pretty tough stuff, and resorting to Java was pretty much necessary. Today I think Clojure does pretty well at exposing a subset of the language that is fast and no more cumbersome to write than Java (or JavaScript) when performance is key. Christophe's version also has the advantage that it can pretty much compile down to efficient JavaScript via ClojureScript and probably an efficient ClojureCLR program as well. This may or may not matter to you. In a Java project it clearly does not matter. In library code it quite likely could matter a lot. That is of course a subject completely separate from the discussion on the pitfalls involved in getting Clojure performance right. Fair enough. My point was simply that Clojure implementations have a small learnable subset that performs well when performance is desired - primitives, loops, arrays, deftypes, etc regardless of host. It's unfortunate that the host, in this case the JVM, requires quite a bit of thinking about type hints and casts. I think most of the challenges around are writing fast Clojure JVM code lie here. I note these issues are not present in ClojureScript ;) Apparently even Cristophe broke quite a bit of sweat to come up with his second solution, and did also wander around searching for bottlenecks (like .equals against =). ^:unsynchronized-mutable is something I've never layed my eyes on before and I've spent quite a bit of time working on optimized Clojure, googling for any trick I could find. What is the most trivially obvious way to solve a probelm in Java takes the most obscure features of Clojure to emulate. It's right there in the docstring of deftype, but OK. Finally, Cristophe's solution, as well as all other optimized Clojure code, seems to be just barely making it for the use case involved. In my code, for example, I struggle with such things as an array of Strings (received from a Java method) failing when used in amap, which needs an array of Objects. I'm sure I could come up with yet another layer of obscurity which would make this work, but, as I said, after several months of struggling I'm ready to settle for 100 lines of clean, elegant, obvious Java. Perhaps it's because I lack considerable experience with Java that I don't find it so challenging. Yes it's a bit finicky, yes it could be improved, but it still beats writing Java in my mind. David -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Why is java.io/do-copy defined private
Hi, I implemented (defmethod (var-get #'io/do-copy) [Path Path] [#^Path input #^Path output opts] ...) for fast NIO2 io, but had to do the var-get workaround because do-copy is defined private. Jürgen -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Clojure Performance For Expensive Algorithms
It's right there in the docstring of deftype, but OK. ...followed by several sentences of big fat warnings, including that they are present only to facilitate the building of higher level constructs, such as Clojure's reference types, in Clojure itself. Other than that, you are right, it's there in the docstring :) Fair enough. My point was simply that Clojure implementations have a small learnable subset that performs well when performance is desired - primitives, loops, arrays, deftypes, etc regardless of host. It's unfortunate that the host, in this case the JVM, requires quite a bit of thinking about type hints and casts. I think most of the challenges around are writing fast Clojure JVM code lie here. I note these issues are not present in ClojureScript ;) OK, but does that mean that at the end of the day, optimized ClojureScript performance is head-to-head with optimized JVM Clojure in a desktop/server side application? Finally, Cristophe's solution, as well as all other optimized Clojure code, seems to be just barely making it for the use case involved. In my code, for example, I struggle with such things as an array of Strings (received from a Java method) failing when used in amap, which needs an array of Objects. I'm sure I could come up with yet another layer of obscurity which would make this work, but, as I said, after several months of struggling I'm ready to settle for 100 lines of clean, elegant, obvious Java. Perhaps it's because I lack considerable experience with Java that I don't find it so challenging. Yes it's a bit finicky, yes it could be improved, but it still beats writing Java in my mind. I'll give you one specific item that I keep tripping upon: the lack of reassignable, stack-based locals. Without them I can't efficiently get more than one value out of a loop. Another item is that I can get zero primitive values out of a loop. How do you cope with those? When on the subject, the times are getting ripe for a full-length book not about how handsome and elegant and FP-y Clojure is (we have plenty of those), but a terrorist's handbook on writing performant Clojure. Can you recommend any current material in that direction? -Marko -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Clojure Performance For Expensive Algorithms
On Fri, Feb 22, 2013 at 2:06 PM, Marko Topolnik marko.topol...@gmail.comwrote: Fair enough. My point was simply that Clojure implementations have a small learnable subset that performs well when performance is desired - primitives, loops, arrays, deftypes, etc regardless of host. It's unfortunate that the host, in this case the JVM, requires quite a bit of thinking about type hints and casts. I think most of the challenges around are writing fast Clojure JVM code lie here. I note these issues are not present in ClojureScript ;) OK, but does that mean that at the end of the day, optimized ClojureScript performance is head-to-head with optimized JVM Clojure in a desktop/server side application? I don't think we can ever really be head-to-head and performance varies between JS engines. V8 is particularly good - not surprising since it's from the same folks who worked on HotSpot. That, we try to get the performance of ClojureScript on V8 as close to Clojure on the JVM as we can without sacrificing performance on the other engines. I think we're doing OK and we're improving constantly. I'll give you one specific item that I keep tripping upon: the lack of reassignable, stack-based locals. Without them I can't efficiently get more than one value out of a loop. Another item is that I can get zero primitive values out of a loop. How do you cope with those? Some ideas for the first point: * atoms * implement efficient tuple type which uses mutation for multiple value return I suspect the second option will be pretty fast. Annoying, but that's a tradeoff with Clojure's mostly functional design. Second point, I think 1.5.0 addresses that to some degree thanks to Christophe. When on the subject, the times are getting ripe for a full-length book not about how handsome and elegant and FP-y Clojure is (we have plenty of those), but a terrorist's handbook on writing performant Clojure. Can you recommend any current material in that direction? -Marko Heh, I always point out test.benchmark - http://github.com/clojure/test.benchmark. There's some horrifying stuff in there ;) David -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Clojure Performance For Expensive Algorithms
Er re: assigning stack based locals. Forget wasting time making a tuple type, probably best to just do that with a small mutable array. This worked ok for us when porting some Java persistent data structure code to ClojureScript. On Friday, February 22, 2013, David Nolen wrote: On Fri, Feb 22, 2013 at 2:06 PM, Marko Topolnik marko.topol...@gmail.comjavascript:_e({}, 'cvml', 'marko.topol...@gmail.com'); wrote: Fair enough. My point was simply that Clojure implementations have a small learnable subset that performs well when performance is desired - primitives, loops, arrays, deftypes, etc regardless of host. It's unfortunate that the host, in this case the JVM, requires quite a bit of thinking about type hints and casts. I think most of the challenges around are writing fast Clojure JVM code lie here. I note these issues are not present in ClojureScript ;) OK, but does that mean that at the end of the day, optimized ClojureScript performance is head-to-head with optimized JVM Clojure in a desktop/server side application? I don't think we can ever really be head-to-head and performance varies between JS engines. V8 is particularly good - not surprising since it's from the same folks who worked on HotSpot. That, we try to get the performance of ClojureScript on V8 as close to Clojure on the JVM as we can without sacrificing performance on the other engines. I think we're doing OK and we're improving constantly. I'll give you one specific item that I keep tripping upon: the lack of reassignable, stack-based locals. Without them I can't efficiently get more than one value out of a loop. Another item is that I can get zero primitive values out of a loop. How do you cope with those? Some ideas for the first point: * atoms * implement efficient tuple type which uses mutation for multiple value return I suspect the second option will be pretty fast. Annoying, but that's a tradeoff with Clojure's mostly functional design. Second point, I think 1.5.0 addresses that to some degree thanks to Christophe. When on the subject, the times are getting ripe for a full-length book not about how handsome and elegant and FP-y Clojure is (we have plenty of those), but a terrorist's handbook on writing performant Clojure. Can you recommend any current material in that direction? -Marko Heh, I always point out test.benchmark - http://github.com/clojure/test.benchmark. There's some horrifying stuff in there ;) David -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Clojure Performance For Expensive Algorithms
On Friday, February 22, 2013 8:23:38 PM UTC+1, David Nolen wrote: I'll give you one specific item that I keep tripping upon: the lack of reassignable, stack-based locals. Without them I can't efficiently get more than one value out of a loop. Another item is that I can get zero primitive values out of a loop. How do you cope with those? Some ideas for the first point: * atoms These are thread-safe and nowhere near as efficient as stack-based locals. * implement efficient tuple type which uses mutation for multiple value return Basically, this is the ^:unsynchronized-mutable that we just mentioned :) This is much better, but still it's not stack-based, so incurs the cost of allocation and GC. I suspect the second option will be pretty fast. Annoying, but that's a tradeoff with Clojure's mostly functional design. Annoying *and* slower than Java's locals, unfortunately. Most of the time it won't make a huge dent in the performance, but I just happen to have an inner loop that iterates between zero and three times only, zero being by far the most common case, and is entered many times from the surrounding loop. The performance drop is considerable. Second point, I think 1.5.0 addresses that to some degree thanks to Christophe. As far as I got it, it only prevents loop-recur from destroying the primitive-returning semantics of functions. Loops used within function bodies stay the same. Heh, I always point out test.benchmark - http://github.com/clojure/test.benchmark. There's some horrifying stuff in there ;) I remember you mentioning that on StackOverflow, maybe it's time for me to check it out more seriously. -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Clojure Performance For Expensive Algorithms
On Friday, February 22, 2013 8:44:30 PM UTC+1, Marko Topolnik wrote: * implement efficient tuple type which uses mutation for multiple value return Basically, this is the ^:unsynchronized-mutable that we just mentioned :) This is much better, but still it's not stack-based, so incurs the cost of allocation and GC. Forgot to mention another hugely important factor: heap-allocated objects spell disaster for CPU cachelines. With today's architectures the difference between a cache hit and a cache miss is like the difference between catching your bus to work and having to walk instead. In our example I would have to be careful to reuse the same deftype instance for all inner loop runs, but then I'd need even more code to make sure the values are reset before entering. The result would be messy, brittle code with higher-level logic scattered between all the housekeeping constructs. -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Clojure Performance For Expensive Algorithms
On Friday, February 22, 2013, Marko Topolnik wrote: Annoying *and* slower than Java's locals, unfortunately. Most of the time it won't make a huge dent in the performance, but I just happen to have an inner loop that iterates between zero and three times only, zero being by far the most common case, and is entered many times from the surrounding loop. The performance drop is considerable. If the loops are so small why can't you just make these be more loop bindings? -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Clojure 1.5 RC 17 wending through the maven pipes
Only change from RC 16 is http://dev.clojure.org/jira/browse/CLJ-1168. Please test for regression. Stu -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Clojure Performance For Expensive Algorithms
On Friday, February 22, 2013 9:04:31 PM UTC+1, David Nolen wrote: On Friday, February 22, 2013, Marko Topolnik wrote: Annoying *and* slower than Java's locals, unfortunately. Most of the time it won't make a huge dent in the performance, but I just happen to have an inner loop that iterates between zero and three times only, zero being by far the most common case, and is entered many times from the surrounding loop. The performance drop is considerable. If the loops are so small why can't you just make these be more loop bindings? Because the number of iterations is driven by outside data. On occasion it may be more than three iterations; from the logic standpoint this is clearly a loop, it's just that the statistical distribution of iterations leans heavily towards zero and almost vanishes above three or four. -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Clojure Performance For Expensive Algorithms
On Friday, February 22, 2013 8:41:15 PM UTC+1, David Nolen wrote: Er re: assigning stack based locals. Forget wasting time making a tuple type, probably best to just do that with a small mutable array. This worked ok for us when porting some Java persistent data structure code to ClojureScript. Again, must reuse the same array for all inner iterations to avoid allocation, GC, and cache misses. I need two Strings and one primitive double, so I'm actually looking at two arrays. The housekeeping overhead is just too much for my taste. That's why the rewrite into Java came as such a relief :) -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Clojure Performance For Expensive Algorithms
OK, though threading one 3 element object array into the loop with one double cast doesn't really seem that problematic or slow to me. On Fri, Feb 22, 2013 at 3:27 PM, Marko Topolnik marko.topol...@gmail.comwrote: On Friday, February 22, 2013 8:41:15 PM UTC+1, David Nolen wrote: Er re: assigning stack based locals. Forget wasting time making a tuple type, probably best to just do that with a small mutable array. This worked ok for us when porting some Java persistent data structure code to ClojureScript. Again, must reuse the same array for all inner iterations to avoid allocation, GC, and cache misses. I need two Strings and one primitive double, so I'm actually looking at two arrays. The housekeeping overhead is just too much for my taste. That's why the rewrite into Java came as such a relief :) -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Clojure Performance For Expensive Algorithms
Oh right, sorry, you don't want to pay for boxing the double. Yeah this is the case where you'd want to go with a tuple. If this really was common in my own code I would probably write a mutable tuple macro. But I totally understand why someone else might just write the Java if they just want performance and just don't want to bother. On Fri, Feb 22, 2013 at 3:27 PM, Marko Topolnik marko.topol...@gmail.comwrote: On Friday, February 22, 2013 8:41:15 PM UTC+1, David Nolen wrote: Er re: assigning stack based locals. Forget wasting time making a tuple type, probably best to just do that with a small mutable array. This worked ok for us when porting some Java persistent data structure code to ClojureScript. Again, must reuse the same array for all inner iterations to avoid allocation, GC, and cache misses. I need two Strings and one primitive double, so I'm actually looking at two arrays. The housekeeping overhead is just too much for my taste. That's why the rewrite into Java came as such a relief :) -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Clojure Performance For Expensive Algorithms
It wouldn't be a first for me, either; I'm already accustomed to writing macros for performance. For example, unrolling writer.append loops, using jassoc as a Java HashMap replacement for assoc, and many similar tricks. On this particular occasion, where the performance-critical code segment has gradually grown to over 100 lines, and where with each development iteration I had to set up profiling sessions, painstakingly work through VisualVM traces, devise hypotheses, try out solutions, etc., the point was reached where I called it a day and rewrote to Java. Not to say that having Java involved is any picnic: each change requires restarting the nREPL session, recompiling everything, reconnecting nrepl.el, reinitializing database connection and Lucene indexes, and so on. The pain is substantial but it feels like a relief nevertheless. On Friday, February 22, 2013 9:54:18 PM UTC+1, David Nolen wrote: Oh right, sorry, you don't want to pay for boxing the double. Yeah this is the case where you'd want to go with a tuple. If this really was common in my own code I would probably write a mutable tuple macro. But I totally understand why someone else might just write the Java if they just want performance and just don't want to bother. On Fri, Feb 22, 2013 at 3:27 PM, Marko Topolnik marko.t...@gmail.comjavascript: wrote: On Friday, February 22, 2013 8:41:15 PM UTC+1, David Nolen wrote: Er re: assigning stack based locals. Forget wasting time making a tuple type, probably best to just do that with a small mutable array. This worked ok for us when porting some Java persistent data structure code to ClojureScript. Again, must reuse the same array for all inner iterations to avoid allocation, GC, and cache misses. I need two Strings and one primitive double, so I'm actually looking at two arrays. The housekeeping overhead is just too much for my taste. That's why the rewrite into Java came as such a relief :) -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.comjavascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Clojure JSR-331 - Puzzles
Hello everyone ... I am an amateur of Computer Science ... and I have a blog where I include some of my personal work ... now I have a project to create a version of some puzzles that I found on the www in Clojure JSR-331, and I would share it with you ... sorry for any mistakes please... :D http://mx-clojure.blogspot.com/ https://github.com/maxtuno/Clojure---JSR-331---Puzzles http://www.scribd.com/doc/126804200/Clojure-JSR-331-Puzzles (first version) V001 - Friday 22 Feb 2013 Santiago, Chile -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
how do I include a single class file from someone else's library?
I am ignorant of the JVM, and of Java, so I am sure this is a dumb question. I need to post to the Omniture API. They offer some sample code here: https://developer.omniture.com/en_US/blog/calling-rest-api-in-java That code depends on a Base64Coder class which they offer in a zip file. I downloaded it and did: javac Base64Coder.java and this gave me Base64Coder.class. I created my project with Leinengen2. I thought maybe I could just copy Base64Coder.class to the target/classes folder, but then how would I reference it in my code? -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: how do I include a single class file from someone else's library?
When I just do something obvious, like in mpdv.core: (ns mpdv.core (:gen-class) (:import (Base64Coder)) and then call its static methods I get: Exception in thread main java.lang.NoClassDefFoundError: Base64Coder (wrong name: com/omniture/security/Base64Coder), compiling:(mpdv/core.clj:130) On Friday, February 22, 2013 4:18:00 PM UTC-5, larry google groups wrote: I am ignorant of the JVM, and of Java, so I am sure this is a dumb question. I need to post to the Omniture API. They offer some sample code here: https://developer.omniture.com/en_US/blog/calling-rest-api-in-java That code depends on a Base64Coder class which they offer in a zip file. I downloaded it and did: javac Base64Coder.java and this gave me Base64Coder.class. I created my project with Leinengen2. I thought maybe I could just copy Base64Coder.class to the target/classes folder, but then how would I reference it in my code? -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Why is java.io/do-copy defined private
Hi Jürgen, Things are declared :private usually because the author of the library didn't want to commit to a public API function in future releases. The var-get trick works fine (you can also write @#'io/do-copy) but there's no promise that `do-copy` will stay the same between releases. As long as you're aware that your code might be broken by a future release, there's no reason not to extend it as you did. Since Clojure is designed to be compatible with JDK 1.5, it doesn't use NIO2 anywhere. Perhaps conditional compilation (a possible feature for Clojure 1.6) will make it possible to support newer JDK features like NIO2. -S On Friday, February 22, 2013 12:23:27 PM UTC-5, Jürgen Hötzel wrote: Hi, I implemented (defmethod (var-get #'io/do-copy) [Path Path] [#^Path input #^Path output opts] ...) for fast NIO2 io, but had to do the var-get workaround because do-copy is defined private. Jürgen -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: how do I include a single class file from someone else's library?
Ah, I see. This is a polygot project, which Leiningen describes here: https://github.com/technomancy/leiningen/blob/stable/doc/MIXED_PROJECTS.md That worked for me. Leiningen saves the day again. On Friday, February 22, 2013 4:25:04 PM UTC-5, larry google groups wrote: When I just do something obvious, like in mpdv.core: (ns mpdv.core (:gen-class) (:import (Base64Coder)) and then call its static methods I get: Exception in thread main java.lang.NoClassDefFoundError: Base64Coder (wrong name: com/omniture/security/Base64Coder), compiling:(mpdv/core.clj:130) On Friday, February 22, 2013 4:18:00 PM UTC-5, larry google groups wrote: I am ignorant of the JVM, and of Java, so I am sure this is a dumb question. I need to post to the Omniture API. They offer some sample code here: https://developer.omniture.com/en_US/blog/calling-rest-api-in-java That code depends on a Base64Coder class which they offer in a zip file. I downloaded it and did: javac Base64Coder.java and this gave me Base64Coder.class. I created my project with Leinengen2. I thought maybe I could just copy Base64Coder.class to the target/classes folder, but then how would I reference it in my code? -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: how do I include a single class file from someone else's library?
Maybe I spoke too soon. I have now stepped into the Twilight Zone. Changes I make to files do not get built when a try to run lein. Just to get some kind of reaction from Leinengen I just put random garbage in the ns clause of my core.clj: (ns lkjlkljlkjlkj mpdv.core (:gen-class) (:import (java.net URL URLConnection) (java.io ByteArrayInputStream BufferedReader IOException InputStream InputStreamReader OutputStreamWriter UnsupportedEncodingException) (java.text SimpleDateFormat) (java.util Date) (java.security MessageDigest) (org.apache.commons.mail SimpleEmail HtmlEmail) (org.joda.time.format DateTimeFormat ISODateTimeFormat) (Base64Coder) (lkjlkjlkjoiuoiu)) This should have caused an error, but instead, when I did lein uberjar everything compiled -- but compiled without any of the changes I've made during the last 30 minutes. In the terminal, from the same terminal that I run lein uberjar I can run: cat src/mpdv/core.clj and I see my changes, including the random garbage that I just wrote, but somehow, if I then type lein uberjar lein does not see it. I do not know if this issue is related, but following the advice about polygots, given here: https://github.com/technomancy/leiningen/blob/stable/doc/MIXED_PROJECTS.md I added this to my project.clj file: :source-paths [src/mpdv] :java-source-paths [src/java] Did I do something wrong here? Why is Leinengen still compiling, even though the source code is full of garbage? On Friday, February 22, 2013 5:01:15 PM UTC-5, larry google groups wrote: Ah, I see. This is a polygot project, which Leiningen describes here: https://github.com/technomancy/leiningen/blob/stable/doc/MIXED_PROJECTS.md That worked for me. Leiningen saves the day again. On Friday, February 22, 2013 4:25:04 PM UTC-5, larry google groups wrote: When I just do something obvious, like in mpdv.core: (ns mpdv.core (:gen-class) (:import (Base64Coder)) and then call its static methods I get: Exception in thread main java.lang.NoClassDefFoundError: Base64Coder (wrong name: com/omniture/security/Base64Coder), compiling:(mpdv/core.clj:130) On Friday, February 22, 2013 4:18:00 PM UTC-5, larry google groups wrote: I am ignorant of the JVM, and of Java, so I am sure this is a dumb question. I need to post to the Omniture API. They offer some sample code here: https://developer.omniture.com/en_US/blog/calling-rest-api-in-java That code depends on a Base64Coder class which they offer in a zip file. I downloaded it and did: javac Base64Coder.java and this gave me Base64Coder.class. I created my project with Leinengen2. I thought maybe I could just copy Base64Coder.class to the target/classes folder, but then how would I reference it in my code? -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: how do I include a single class file from someone else's library?
I see this sentence: Having one source root contain another (e.g. src and src/java) can cause obscure problems. but I have: src/ java/ mpdv/ Which I assume is what Leinengen is asking for. On Friday, February 22, 2013 5:23:28 PM UTC-5, larry google groups wrote: Maybe I spoke too soon. I have now stepped into the Twilight Zone. Changes I make to files do not get built when a try to run lein. Just to get some kind of reaction from Leinengen I just put random garbage in the ns clause of my core.clj: (ns lkjlkljlkjlkj mpdv.core (:gen-class) (:import (java.net URL URLConnection) (java.io ByteArrayInputStream BufferedReader IOException InputStream InputStreamReader OutputStreamWriter UnsupportedEncodingException) (java.text SimpleDateFormat) (java.util Date) (java.security MessageDigest) (org.apache.commons.mail SimpleEmail HtmlEmail) (org.joda.time.format DateTimeFormat ISODateTimeFormat) (Base64Coder) (lkjlkjlkjoiuoiu)) This should have caused an error, but instead, when I did lein uberjar everything compiled -- but compiled without any of the changes I've made during the last 30 minutes. In the terminal, from the same terminal that I run lein uberjar I can run: cat src/mpdv/core.clj and I see my changes, including the random garbage that I just wrote, but somehow, if I then type lein uberjar lein does not see it. I do not know if this issue is related, but following the advice about polygots, given here: https://github.com/technomancy/leiningen/blob/stable/doc/MIXED_PROJECTS.md I added this to my project.clj file: :source-paths [src/mpdv] :java-source-paths [src/java] Did I do something wrong here? Why is Leinengen still compiling, even though the source code is full of garbage? On Friday, February 22, 2013 5:01:15 PM UTC-5, larry google groups wrote: Ah, I see. This is a polygot project, which Leiningen describes here: https://github.com/technomancy/leiningen/blob/stable/doc/MIXED_PROJECTS.md That worked for me. Leiningen saves the day again. On Friday, February 22, 2013 4:25:04 PM UTC-5, larry google groups wrote: When I just do something obvious, like in mpdv.core: (ns mpdv.core (:gen-class) (:import (Base64Coder)) and then call its static methods I get: Exception in thread main java.lang.NoClassDefFoundError: Base64Coder (wrong name: com/omniture/security/Base64Coder), compiling:(mpdv/core.clj:130) On Friday, February 22, 2013 4:18:00 PM UTC-5, larry google groups wrote: I am ignorant of the JVM, and of Java, so I am sure this is a dumb question. I need to post to the Omniture API. They offer some sample code here: https://developer.omniture.com/en_US/blog/calling-rest-api-in-java That code depends on a Base64Coder class which they offer in a zip file. I downloaded it and did: javac Base64Coder.java and this gave me Base64Coder.class. I created my project with Leinengen2. I thought maybe I could just copy Base64Coder.class to the target/classes folder, but then how would I reference it in my code? -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: how do I include a single class file from someone else's library?
At least if I put random junk in the project.clj, Leinengen dies with an error: (defproject mpdv 0.1.0 :dependencies [[org.clojure/clojure 1.4.0] [ring 1.1.5] [ring/ring-jetty-adapter 1.1.5] [org.clojure/data.json 0.2.0] [org.clojure/java.jdbc 0.2.3] [mysql/mysql-connector-java 5.1.6] jlkjlkjlkjlkj [clj-yaml 0.4.0] [clj-time 0.4.4] lein uberjar nth not supported on this type: Symbol But otherwise, it is not seeing the changes I make to the code. On Friday, February 22, 2013 5:28:17 PM UTC-5, larry google groups wrote: I see this sentence: Having one source root contain another (e.g. src and src/java) can cause obscure problems. but I have: src/ java/ mpdv/ Which I assume is what Leinengen is asking for. On Friday, February 22, 2013 5:23:28 PM UTC-5, larry google groups wrote: Maybe I spoke too soon. I have now stepped into the Twilight Zone. Changes I make to files do not get built when a try to run lein. Just to get some kind of reaction from Leinengen I just put random garbage in the ns clause of my core.clj: (ns lkjlkljlkjlkj mpdv.core (:gen-class) (:import (java.net URL URLConnection) (java.io ByteArrayInputStream BufferedReader IOException InputStream InputStreamReader OutputStreamWriter UnsupportedEncodingException) (java.text SimpleDateFormat) (java.util Date) (java.security MessageDigest) (org.apache.commons.mail SimpleEmail HtmlEmail) (org.joda.time.format DateTimeFormat ISODateTimeFormat) (Base64Coder) (lkjlkjlkjoiuoiu)) This should have caused an error, but instead, when I did lein uberjar everything compiled -- but compiled without any of the changes I've made during the last 30 minutes. In the terminal, from the same terminal that I run lein uberjar I can run: cat src/mpdv/core.clj and I see my changes, including the random garbage that I just wrote, but somehow, if I then type lein uberjar lein does not see it. I do not know if this issue is related, but following the advice about polygots, given here: https://github.com/technomancy/leiningen/blob/stable/doc/MIXED_PROJECTS.md I added this to my project.clj file: :source-paths [src/mpdv] :java-source-paths [src/java] Did I do something wrong here? Why is Leinengen still compiling, even though the source code is full of garbage? On Friday, February 22, 2013 5:01:15 PM UTC-5, larry google groups wrote: Ah, I see. This is a polygot project, which Leiningen describes here: https://github.com/technomancy/leiningen/blob/stable/doc/MIXED_PROJECTS.md That worked for me. Leiningen saves the day again. On Friday, February 22, 2013 4:25:04 PM UTC-5, larry google groups wrote: When I just do something obvious, like in mpdv.core: (ns mpdv.core (:gen-class) (:import (Base64Coder)) and then call its static methods I get: Exception in thread main java.lang.NoClassDefFoundError: Base64Coder (wrong name: com/omniture/security/Base64Coder), compiling:(mpdv/core.clj:130) On Friday, February 22, 2013 4:18:00 PM UTC-5, larry google groups wrote: I am ignorant of the JVM, and of Java, so I am sure this is a dumb question. I need to post to the Omniture API. They offer some sample code here: https://developer.omniture.com/en_US/blog/calling-rest-api-in-java That code depends on a Base64Coder class which they offer in a zip file. I downloaded it and did: javac Base64Coder.java and this gave me Base64Coder.class. I created my project with Leinengen2. I thought maybe I could just copy Base64Coder.class to the target/classes folder, but then how would I reference it in my code? -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: how do I include a single class file from someone else's library?
No, src is root for all Clojure. That means that your java root is under the Clojure root. Move java to top-level. On Friday, February 22, 2013 11:28:17 PM UTC+1, larry google groups wrote: I see this sentence: Having one source root contain another (e.g. src and src/java) can cause obscure problems. but I have: src/ java/ mpdv/ Which I assume is what Leinengen is asking for. On Friday, February 22, 2013 5:23:28 PM UTC-5, larry google groups wrote: Maybe I spoke too soon. I have now stepped into the Twilight Zone. Changes I make to files do not get built when a try to run lein. Just to get some kind of reaction from Leinengen I just put random garbage in the ns clause of my core.clj: (ns lkjlkljlkjlkj mpdv.core (:gen-class) (:import (java.net URL URLConnection) (java.io ByteArrayInputStream BufferedReader IOException InputStream InputStreamReader OutputStreamWriter UnsupportedEncodingException) (java.text SimpleDateFormat) (java.util Date) (java.security MessageDigest) (org.apache.commons.mail SimpleEmail HtmlEmail) (org.joda.time.format DateTimeFormat ISODateTimeFormat) (Base64Coder) (lkjlkjlkjoiuoiu)) This should have caused an error, but instead, when I did lein uberjar everything compiled -- but compiled without any of the changes I've made during the last 30 minutes. In the terminal, from the same terminal that I run lein uberjar I can run: cat src/mpdv/core.clj and I see my changes, including the random garbage that I just wrote, but somehow, if I then type lein uberjar lein does not see it. I do not know if this issue is related, but following the advice about polygots, given here: https://github.com/technomancy/leiningen/blob/stable/doc/MIXED_PROJECTS.md I added this to my project.clj file: :source-paths [src/mpdv] :java-source-paths [src/java] Did I do something wrong here? Why is Leinengen still compiling, even though the source code is full of garbage? On Friday, February 22, 2013 5:01:15 PM UTC-5, larry google groups wrote: Ah, I see. This is a polygot project, which Leiningen describes here: https://github.com/technomancy/leiningen/blob/stable/doc/MIXED_PROJECTS.md That worked for me. Leiningen saves the day again. On Friday, February 22, 2013 4:25:04 PM UTC-5, larry google groups wrote: When I just do something obvious, like in mpdv.core: (ns mpdv.core (:gen-class) (:import (Base64Coder)) and then call its static methods I get: Exception in thread main java.lang.NoClassDefFoundError: Base64Coder (wrong name: com/omniture/security/Base64Coder), compiling:(mpdv/core.clj:130) On Friday, February 22, 2013 4:18:00 PM UTC-5, larry google groups wrote: I am ignorant of the JVM, and of Java, so I am sure this is a dumb question. I need to post to the Omniture API. They offer some sample code here: https://developer.omniture.com/en_US/blog/calling-rest-api-in-java That code depends on a Base64Coder class which they offer in a zip file. I downloaded it and did: javac Base64Coder.java and this gave me Base64Coder.class. I created my project with Leinengen2. I thought maybe I could just copy Base64Coder.class to the target/classes folder, but then how would I reference it in my code? -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: how do I include a single class file from someone else's library?
Hmm, okay. Seems to be working with: :source-paths [src] :java-source-paths [src_java] The example on the Leiningen site might be clear to those who know the JVM, but it was not clear to me. But now I have the earlier problem: Caused by: java.lang.RuntimeException: No such namespace: Base64Coder Not sure how to import this. I tried a simple: (ns mpdv.core (:gen-class) (:import (Base64Coder)) But that does not work. On Friday, February 22, 2013 5:31:49 PM UTC-5, Marko Topolnik wrote: No, src is root for all Clojure. That means that your java root is under the Clojure root. Move java to top-level. On Friday, February 22, 2013 11:28:17 PM UTC+1, larry google groups wrote: I see this sentence: Having one source root contain another (e.g. src and src/java) can cause obscure problems. but I have: src/ java/ mpdv/ Which I assume is what Leinengen is asking for. On Friday, February 22, 2013 5:23:28 PM UTC-5, larry google groups wrote: Maybe I spoke too soon. I have now stepped into the Twilight Zone. Changes I make to files do not get built when a try to run lein. Just to get some kind of reaction from Leinengen I just put random garbage in the ns clause of my core.clj: (ns lkjlkljlkjlkj mpdv.core (:gen-class) (:import (java.net URL URLConnection) (java.io ByteArrayInputStream BufferedReader IOException InputStream InputStreamReader OutputStreamWriter UnsupportedEncodingException) (java.text SimpleDateFormat) (java.util Date) (java.security MessageDigest) (org.apache.commons.mail SimpleEmail HtmlEmail) (org.joda.time.format DateTimeFormat ISODateTimeFormat) (Base64Coder) (lkjlkjlkjoiuoiu)) This should have caused an error, but instead, when I did lein uberjar everything compiled -- but compiled without any of the changes I've made during the last 30 minutes. In the terminal, from the same terminal that I run lein uberjar I can run: cat src/mpdv/core.clj and I see my changes, including the random garbage that I just wrote, but somehow, if I then type lein uberjar lein does not see it. I do not know if this issue is related, but following the advice about polygots, given here: https://github.com/technomancy/leiningen/blob/stable/doc/MIXED_PROJECTS.md I added this to my project.clj file: :source-paths [src/mpdv] :java-source-paths [src/java] Did I do something wrong here? Why is Leinengen still compiling, even though the source code is full of garbage? On Friday, February 22, 2013 5:01:15 PM UTC-5, larry google groups wrote: Ah, I see. This is a polygot project, which Leiningen describes here: https://github.com/technomancy/leiningen/blob/stable/doc/MIXED_PROJECTS.md That worked for me. Leiningen saves the day again. On Friday, February 22, 2013 4:25:04 PM UTC-5, larry google groups wrote: When I just do something obvious, like in mpdv.core: (ns mpdv.core (:gen-class) (:import (Base64Coder)) and then call its static methods I get: Exception in thread main java.lang.NoClassDefFoundError: Base64Coder (wrong name: com/omniture/security/Base64Coder), compiling:(mpdv/core.clj:130) On Friday, February 22, 2013 4:18:00 PM UTC-5, larry google groups wrote: I am ignorant of the JVM, and of Java, so I am sure this is a dumb question. I need to post to the Omniture API. They offer some sample code here: https://developer.omniture.com/en_US/blog/calling-rest-api-in-java That code depends on a Base64Coder class which they offer in a zip file. I downloaded it and did: javac Base64Coder.java and this gave me Base64Coder.class. I created my project with Leinengen2. I thought maybe I could just copy Base64Coder.class to the target/classes folder, but then how would I reference it in my code? -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: how do I include a single class file from someone else's library?
use fully qualified name for that class, I think? On Fri, Feb 22, 2013 at 11:50 PM, larry google groups lawrencecloj...@gmail.com wrote: Hmm, okay. Seems to be working with: :source-paths [src] :java-source-paths [src_java] The example on the Leiningen site might be clear to those who know the JVM, but it was not clear to me. But now I have the earlier problem: Caused by: java.lang.RuntimeException: No such namespace: Base64Coder Not sure how to import this. I tried a simple: (ns mpdv.core (:gen-class) (:import (Base64Coder)) But that does not work. On Friday, February 22, 2013 5:31:49 PM UTC-5, Marko Topolnik wrote: No, src is root for all Clojure. That means that your java root is under the Clojure root. Move java to top-level. On Friday, February 22, 2013 11:28:17 PM UTC+1, larry google groups wrote: I see this sentence: Having one source root contain another (e.g. src and src/java) can cause obscure problems. but I have: src/ java/ mpdv/ Which I assume is what Leinengen is asking for. On Friday, February 22, 2013 5:23:28 PM UTC-5, larry google groups wrote: Maybe I spoke too soon. I have now stepped into the Twilight Zone. Changes I make to files do not get built when a try to run lein. Just to get some kind of reaction from Leinengen I just put random garbage in the ns clause of my core.clj: (ns lkjlkljlkjlkj mpdv.core (:gen-class) (:import (java.net URL URLConnection) (java.io ByteArrayInputStream BufferedReader IOException InputStream InputStreamReader OutputStreamWriter UnsupportedEncodingException) (java.text SimpleDateFormat) (java.util Date) (java.security MessageDigest) (org.apache.commons.mail SimpleEmail HtmlEmail) (org.joda.time.format DateTimeFormat ISODateTimeFormat) (Base64Coder) (lkjlkjlkjoiuoiu)) This should have caused an error, but instead, when I did lein uberjar everything compiled -- but compiled without any of the changes I've made during the last 30 minutes. In the terminal, from the same terminal that I run lein uberjar I can run: cat src/mpdv/core.clj and I see my changes, including the random garbage that I just wrote, but somehow, if I then type lein uberjar lein does not see it. I do not know if this issue is related, but following the advice about polygots, given here: https://github.com/**technomancy/leiningen/blob/** stable/doc/MIXED_PROJECTS.mdhttps://github.com/technomancy/leiningen/blob/stable/doc/MIXED_PROJECTS.md I added this to my project.clj file: :source-paths [src/mpdv] :java-source-paths [src/java] Did I do something wrong here? Why is Leinengen still compiling, even though the source code is full of garbage? On Friday, February 22, 2013 5:01:15 PM UTC-5, larry google groups wrote: Ah, I see. This is a polygot project, which Leiningen describes here: https://github.com/**technomancy/leiningen/blob/** stable/doc/MIXED_PROJECTS.mdhttps://github.com/technomancy/leiningen/blob/stable/doc/MIXED_PROJECTS.md That worked for me. Leiningen saves the day again. On Friday, February 22, 2013 4:25:04 PM UTC-5, larry google groups wrote: When I just do something obvious, like in mpdv.core: (ns mpdv.core (:gen-class) (:import (Base64Coder)) and then call its static methods I get: Exception in thread main java.lang.**NoClassDefFoundError: Base64Coder (wrong name: com/omniture/security/**Base64Coder), compiling:(mpdv/core.clj:130) On Friday, February 22, 2013 4:18:00 PM UTC-5, larry google groups wrote: I am ignorant of the JVM, and of Java, so I am sure this is a dumb question. I need to post to the Omniture API. They offer some sample code here: https://developer.omniture.**com/en_US/blog/calling-rest-** api-in-javahttps://developer.omniture.com/en_US/blog/calling-rest-api-in-java That code depends on a Base64Coder class which they offer in a zip file. I downloaded it and did: javac Base64Coder.java and this gave me Base64Coder.class. I created my project with Leinengen2. I thought maybe I could just copy Base64Coder.class to the target/classes folder, but then how would I reference it in my code? -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Please correct me if I'm wrong or incomplete,
Re: how do I include a single class file from someone else's library?
I don't get it. Whats the fully qualified name of a standalone file that i have locally? On Friday, February 22, 2013 6:03:13 PM UTC-5, AtKaaZ wrote: use fully qualified name for that class, I think? On Fri, Feb 22, 2013 at 11:50 PM, larry google groups lawrenc...@gmail.com javascript: wrote: Hmm, okay. Seems to be working with: :source-paths [src] :java-source-paths [src_java] The example on the Leiningen site might be clear to those who know the JVM, but it was not clear to me. But now I have the earlier problem: Caused by: java.lang.RuntimeException: No such namespace: Base64Coder Not sure how to import this. I tried a simple: (ns mpdv.core (:gen-class) (:import (Base64Coder)) But that does not work. On Friday, February 22, 2013 5:31:49 PM UTC-5, Marko Topolnik wrote: No, src is root for all Clojure. That means that your java root is under the Clojure root. Move java to top-level. On Friday, February 22, 2013 11:28:17 PM UTC+1, larry google groups wrote: I see this sentence: Having one source root contain another (e.g. src and src/java) can cause obscure problems. but I have: src/ java/ mpdv/ Which I assume is what Leinengen is asking for. On Friday, February 22, 2013 5:23:28 PM UTC-5, larry google groups wrote: Maybe I spoke too soon. I have now stepped into the Twilight Zone. Changes I make to files do not get built when a try to run lein. Just to get some kind of reaction from Leinengen I just put random garbage in the ns clause of my core.clj: (ns lkjlkljlkjlkj mpdv.core (:gen-class) (:import (java.net URL URLConnection) (java.io ByteArrayInputStream BufferedReader IOException InputStream InputStreamReader OutputStreamWriter UnsupportedEncodingException) (java.text SimpleDateFormat) (java.util Date) (java.security MessageDigest) (org.apache.commons.mail SimpleEmail HtmlEmail) (org.joda.time.format DateTimeFormat ISODateTimeFormat) (Base64Coder) (lkjlkjlkjoiuoiu)) This should have caused an error, but instead, when I did lein uberjar everything compiled -- but compiled without any of the changes I've made during the last 30 minutes. In the terminal, from the same terminal that I run lein uberjar I can run: cat src/mpdv/core.clj and I see my changes, including the random garbage that I just wrote, but somehow, if I then type lein uberjar lein does not see it. I do not know if this issue is related, but following the advice about polygots, given here: https://github.com/**technomancy/leiningen/blob/** stable/doc/MIXED_PROJECTS.mdhttps://github.com/technomancy/leiningen/blob/stable/doc/MIXED_PROJECTS.md I added this to my project.clj file: :source-paths [src/mpdv] :java-source-paths [src/java] Did I do something wrong here? Why is Leinengen still compiling, even though the source code is full of garbage? On Friday, February 22, 2013 5:01:15 PM UTC-5, larry google groups wrote: Ah, I see. This is a polygot project, which Leiningen describes here: https://github.com/**technomancy/leiningen/blob/** stable/doc/MIXED_PROJECTS.mdhttps://github.com/technomancy/leiningen/blob/stable/doc/MIXED_PROJECTS.md That worked for me. Leiningen saves the day again. On Friday, February 22, 2013 4:25:04 PM UTC-5, larry google groups wrote: When I just do something obvious, like in mpdv.core: (ns mpdv.core (:gen-class) (:import (Base64Coder)) and then call its static methods I get: Exception in thread main java.lang.**NoClassDefFoundError: Base64Coder (wrong name: com/omniture/security/**Base64Coder), compiling:(mpdv/core.clj:130) On Friday, February 22, 2013 4:18:00 PM UTC-5, larry google groups wrote: I am ignorant of the JVM, and of Java, so I am sure this is a dumb question. I need to post to the Omniture API. They offer some sample code here: https://developer.omniture.**com/en_US/blog/calling-rest-** api-in-javahttps://developer.omniture.com/en_US/blog/calling-rest-api-in-java That code depends on a Base64Coder class which they offer in a zip file. I downloaded it and did: javac Base64Coder.java and this gave me Base64Coder.class. I created my project with Leinengen2. I thought maybe I could just copy Base64Coder.class to the target/classes folder, but then how would I reference it in my code? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.comjavascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe
Re: how do I include a single class file from someone else's library?
this: (:import (Base64Coder)) gets me: Caused by: java.lang.RuntimeException: No such namespace: Base64Coder this: (:import (src_java Base64Coder)) gets me: Exception in thread main java.lang.ClassNotFoundException: src_java.Base64Coder, compiling:(core.clj:1) On Friday, February 22, 2013 6:14:42 PM UTC-5, larry google groups wrote: I don't get it. Whats the fully qualified name of a standalone file that i have locally? On Friday, February 22, 2013 6:03:13 PM UTC-5, AtKaaZ wrote: use fully qualified name for that class, I think? On Fri, Feb 22, 2013 at 11:50 PM, larry google groups lawrenc...@gmail.com wrote: Hmm, okay. Seems to be working with: :source-paths [src] :java-source-paths [src_java] The example on the Leiningen site might be clear to those who know the JVM, but it was not clear to me. But now I have the earlier problem: Caused by: java.lang.RuntimeException: No such namespace: Base64Coder Not sure how to import this. I tried a simple: (ns mpdv.core (:gen-class) (:import (Base64Coder)) But that does not work. On Friday, February 22, 2013 5:31:49 PM UTC-5, Marko Topolnik wrote: No, src is root for all Clojure. That means that your java root is under the Clojure root. Move java to top-level. On Friday, February 22, 2013 11:28:17 PM UTC+1, larry google groups wrote: I see this sentence: Having one source root contain another (e.g. src and src/java) can cause obscure problems. but I have: src/ java/ mpdv/ Which I assume is what Leinengen is asking for. On Friday, February 22, 2013 5:23:28 PM UTC-5, larry google groups wrote: Maybe I spoke too soon. I have now stepped into the Twilight Zone. Changes I make to files do not get built when a try to run lein. Just to get some kind of reaction from Leinengen I just put random garbage in the ns clause of my core.clj: (ns lkjlkljlkjlkj mpdv.core (:gen-class) (:import (java.net URL URLConnection) (java.io ByteArrayInputStream BufferedReader IOException InputStream InputStreamReader OutputStreamWriter UnsupportedEncodingException) (java.text SimpleDateFormat) (java.util Date) (java.security MessageDigest) (org.apache.commons.mail SimpleEmail HtmlEmail) (org.joda.time.format DateTimeFormat ISODateTimeFormat) (Base64Coder) (lkjlkjlkjoiuoiu)) This should have caused an error, but instead, when I did lein uberjar everything compiled -- but compiled without any of the changes I've made during the last 30 minutes. In the terminal, from the same terminal that I run lein uberjar I can run: cat src/mpdv/core.clj and I see my changes, including the random garbage that I just wrote, but somehow, if I then type lein uberjar lein does not see it. I do not know if this issue is related, but following the advice about polygots, given here: https://github.com/**technomancy/leiningen/blob/** stable/doc/MIXED_PROJECTS.mdhttps://github.com/technomancy/leiningen/blob/stable/doc/MIXED_PROJECTS.md I added this to my project.clj file: :source-paths [src/mpdv] :java-source-paths [src/java] Did I do something wrong here? Why is Leinengen still compiling, even though the source code is full of garbage? On Friday, February 22, 2013 5:01:15 PM UTC-5, larry google groups wrote: Ah, I see. This is a polygot project, which Leiningen describes here: https://github.com/**technomancy/leiningen/blob/** stable/doc/MIXED_PROJECTS.mdhttps://github.com/technomancy/leiningen/blob/stable/doc/MIXED_PROJECTS.md That worked for me. Leiningen saves the day again. On Friday, February 22, 2013 4:25:04 PM UTC-5, larry google groups wrote: When I just do something obvious, like in mpdv.core: (ns mpdv.core (:gen-class) (:import (Base64Coder)) and then call its static methods I get: Exception in thread main java.lang.**NoClassDefFoundError: Base64Coder (wrong name: com/omniture/security/**Base64Coder), compiling:(mpdv/core.clj:130) On Friday, February 22, 2013 4:18:00 PM UTC-5, larry google groups wrote: I am ignorant of the JVM, and of Java, so I am sure this is a dumb question. I need to post to the Omniture API. They offer some sample code here: https://developer.omniture.**com/en_US/blog/calling-rest-** api-in-javahttps://developer.omniture.com/en_US/blog/calling-rest-api-in-java That code depends on a Base64Coder class which they offer in a zip file. I downloaded it and did: javac Base64Coder.java and this gave me Base64Coder.class. I created my project with Leinengen2. I thought maybe I could just copy Base64Coder.class to the target/classes folder, but then how would I reference it in my code? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com Note that posts from new members are
Re: how do I include a single class file from someone else's library?
You must know the package name of your class. Is it really in the default package? That would be almost impossible since you can't even refer to such a class from another class in a normal package. On Saturday, February 23, 2013 12:20:15 AM UTC+1, larry google groups wrote: this: (:import (Base64Coder)) gets me: Caused by: java.lang.RuntimeException: No such namespace: Base64Coder this: (:import (src_java Base64Coder)) gets me: Exception in thread main java.lang.ClassNotFoundException: src_java.Base64Coder, compiling:(core.clj:1) On Friday, February 22, 2013 6:14:42 PM UTC-5, larry google groups wrote: I don't get it. Whats the fully qualified name of a standalone file that i have locally? On Friday, February 22, 2013 6:03:13 PM UTC-5, AtKaaZ wrote: use fully qualified name for that class, I think? On Fri, Feb 22, 2013 at 11:50 PM, larry google groups lawrenc...@gmail.com wrote: Hmm, okay. Seems to be working with: :source-paths [src] :java-source-paths [src_java] The example on the Leiningen site might be clear to those who know the JVM, but it was not clear to me. But now I have the earlier problem: Caused by: java.lang.RuntimeException: No such namespace: Base64Coder Not sure how to import this. I tried a simple: (ns mpdv.core (:gen-class) (:import (Base64Coder)) But that does not work. On Friday, February 22, 2013 5:31:49 PM UTC-5, Marko Topolnik wrote: No, src is root for all Clojure. That means that your java root is under the Clojure root. Move java to top-level. On Friday, February 22, 2013 11:28:17 PM UTC+1, larry google groups wrote: I see this sentence: Having one source root contain another (e.g. src and src/java) can cause obscure problems. but I have: src/ java/ mpdv/ Which I assume is what Leinengen is asking for. On Friday, February 22, 2013 5:23:28 PM UTC-5, larry google groups wrote: Maybe I spoke too soon. I have now stepped into the Twilight Zone. Changes I make to files do not get built when a try to run lein. Just to get some kind of reaction from Leinengen I just put random garbage in the ns clause of my core.clj: (ns lkjlkljlkjlkj mpdv.core (:gen-class) (:import (java.net URL URLConnection) (java.io ByteArrayInputStream BufferedReader IOException InputStream InputStreamReader OutputStreamWriter UnsupportedEncodingException) (java.text SimpleDateFormat) (java.util Date) (java.security MessageDigest) (org.apache.commons.mail SimpleEmail HtmlEmail) (org.joda.time.format DateTimeFormat ISODateTimeFormat) (Base64Coder) (lkjlkjlkjoiuoiu)) This should have caused an error, but instead, when I did lein uberjar everything compiled -- but compiled without any of the changes I've made during the last 30 minutes. In the terminal, from the same terminal that I run lein uberjar I can run: cat src/mpdv/core.clj and I see my changes, including the random garbage that I just wrote, but somehow, if I then type lein uberjar lein does not see it. I do not know if this issue is related, but following the advice about polygots, given here: https://github.com/**technomancy/leiningen/blob/** stable/doc/MIXED_PROJECTS.mdhttps://github.com/technomancy/leiningen/blob/stable/doc/MIXED_PROJECTS.md I added this to my project.clj file: :source-paths [src/mpdv] :java-source-paths [src/java] Did I do something wrong here? Why is Leinengen still compiling, even though the source code is full of garbage? On Friday, February 22, 2013 5:01:15 PM UTC-5, larry google groups wrote: Ah, I see. This is a polygot project, which Leiningen describes here: https://github.com/**technomancy/leiningen/blob/** stable/doc/MIXED_PROJECTS.mdhttps://github.com/technomancy/leiningen/blob/stable/doc/MIXED_PROJECTS.md That worked for me. Leiningen saves the day again. On Friday, February 22, 2013 4:25:04 PM UTC-5, larry google groups wrote: When I just do something obvious, like in mpdv.core: (ns mpdv.core (:gen-class) (:import (Base64Coder)) and then call its static methods I get: Exception in thread main java.lang.**NoClassDefFoundError: Base64Coder (wrong name: com/omniture/security/**Base64Coder), compiling:(mpdv/core.clj:130) On Friday, February 22, 2013 4:18:00 PM UTC-5, larry google groups wrote: I am ignorant of the JVM, and of Java, so I am sure this is a dumb question. I need to post to the Omniture API. They offer some sample code here: https://developer.omniture.**com/en_US/blog/calling-rest-** api-in-javahttps://developer.omniture.com/en_US/blog/calling-rest-api-in-java That code depends on a Base64Coder class which they offer in a zip file. I downloaded it and did: javac Base64Coder.java and this gave me Base64Coder.class. I created my project with Leinengen2. I thought maybe I could just copy
Re: how do I include a single class file from someone else's library?
Oh, I see, the file declared a package. This worked: (com.omniture.security Base64Coder)) The Java stuff still confuses me. Thanks for all the help. On Friday, February 22, 2013 6:20:15 PM UTC-5, larry google groups wrote: this: (:import (Base64Coder)) gets me: Caused by: java.lang.RuntimeException: No such namespace: Base64Coder this: (:import (src_java Base64Coder)) gets me: Exception in thread main java.lang.ClassNotFoundException: src_java.Base64Coder, compiling:(core.clj:1) On Friday, February 22, 2013 6:14:42 PM UTC-5, larry google groups wrote: I don't get it. Whats the fully qualified name of a standalone file that i have locally? On Friday, February 22, 2013 6:03:13 PM UTC-5, AtKaaZ wrote: use fully qualified name for that class, I think? On Fri, Feb 22, 2013 at 11:50 PM, larry google groups lawrenc...@gmail.com wrote: Hmm, okay. Seems to be working with: :source-paths [src] :java-source-paths [src_java] The example on the Leiningen site might be clear to those who know the JVM, but it was not clear to me. But now I have the earlier problem: Caused by: java.lang.RuntimeException: No such namespace: Base64Coder Not sure how to import this. I tried a simple: (ns mpdv.core (:gen-class) (:import (Base64Coder)) But that does not work. On Friday, February 22, 2013 5:31:49 PM UTC-5, Marko Topolnik wrote: No, src is root for all Clojure. That means that your java root is under the Clojure root. Move java to top-level. On Friday, February 22, 2013 11:28:17 PM UTC+1, larry google groups wrote: I see this sentence: Having one source root contain another (e.g. src and src/java) can cause obscure problems. but I have: src/ java/ mpdv/ Which I assume is what Leinengen is asking for. On Friday, February 22, 2013 5:23:28 PM UTC-5, larry google groups wrote: Maybe I spoke too soon. I have now stepped into the Twilight Zone. Changes I make to files do not get built when a try to run lein. Just to get some kind of reaction from Leinengen I just put random garbage in the ns clause of my core.clj: (ns lkjlkljlkjlkj mpdv.core (:gen-class) (:import (java.net URL URLConnection) (java.io ByteArrayInputStream BufferedReader IOException InputStream InputStreamReader OutputStreamWriter UnsupportedEncodingException) (java.text SimpleDateFormat) (java.util Date) (java.security MessageDigest) (org.apache.commons.mail SimpleEmail HtmlEmail) (org.joda.time.format DateTimeFormat ISODateTimeFormat) (Base64Coder) (lkjlkjlkjoiuoiu)) This should have caused an error, but instead, when I did lein uberjar everything compiled -- but compiled without any of the changes I've made during the last 30 minutes. In the terminal, from the same terminal that I run lein uberjar I can run: cat src/mpdv/core.clj and I see my changes, including the random garbage that I just wrote, but somehow, if I then type lein uberjar lein does not see it. I do not know if this issue is related, but following the advice about polygots, given here: https://github.com/**technomancy/leiningen/blob/** stable/doc/MIXED_PROJECTS.mdhttps://github.com/technomancy/leiningen/blob/stable/doc/MIXED_PROJECTS.md I added this to my project.clj file: :source-paths [src/mpdv] :java-source-paths [src/java] Did I do something wrong here? Why is Leinengen still compiling, even though the source code is full of garbage? On Friday, February 22, 2013 5:01:15 PM UTC-5, larry google groups wrote: Ah, I see. This is a polygot project, which Leiningen describes here: https://github.com/**technomancy/leiningen/blob/** stable/doc/MIXED_PROJECTS.mdhttps://github.com/technomancy/leiningen/blob/stable/doc/MIXED_PROJECTS.md That worked for me. Leiningen saves the day again. On Friday, February 22, 2013 4:25:04 PM UTC-5, larry google groups wrote: When I just do something obvious, like in mpdv.core: (ns mpdv.core (:gen-class) (:import (Base64Coder)) and then call its static methods I get: Exception in thread main java.lang.**NoClassDefFoundError: Base64Coder (wrong name: com/omniture/security/**Base64Coder), compiling:(mpdv/core.clj:130) On Friday, February 22, 2013 4:18:00 PM UTC-5, larry google groups wrote: I am ignorant of the JVM, and of Java, so I am sure this is a dumb question. I need to post to the Omniture API. They offer some sample code here: https://developer.omniture.**com/en_US/blog/calling-rest-** api-in-javahttps://developer.omniture.com/en_US/blog/calling-rest-api-in-java That code depends on a Base64Coder class which they offer in a zip file. I downloaded it and did: javac Base64Coder.java and this gave me Base64Coder.class. I created my project with Leinengen2. I thought maybe I could just copy Base64Coder.class to the target/classes folder, but then
Re: Clojure Performance For Expensive Algorithms
Isn't that always the way, though? Build your program in a powerful, expressive language, then profile it, find the critical parts, and optimise them - where possible in the same language, and where that's too ugly/painful, drop down a layer to a lower level language. I did lots of this in the late '80s - I wrote programs in C, found where they were slow, optimised the C where it was viable, and re-implemented the core bits in assembler. This was great for high performance on a single cpu architecture, but over the years CPUs got faster and CPUs changed - among other things they optimised differently, so speed tweaks for an 80386 were actually slower on a Pentium. I tend to think clojure is in a similar position - fast enough for the vast majority of things (ymmv of course - depending on what your domain is) and if you meet a situation like this where optimising the clojure becomes too ugly, you can drop down to Java (or indeed C!) - but you lose interoperability with ClojureScript, and hopefully in time language and VM improvements will make this less necessary. - Korny -- Sent from my geek device... Spelling mistakes can be blamed on Google Whatever the final performance achieved, the fact remains that the original Java code was much cleaner, simpler, and more comprehensible than the big ball of mud the performant Clojure version is turning into. I have my own piece of performance-critical code that I used to maintain and improve over a timespan of many months. I finally gave in and recoded the thing in Java. It took only a couple of hours and the result was nice, clean, idiomatic Java code, with completely predictable performance characteristics, as opposed to the Clojure version where it took many hours of staring at ridiculuously counterintuitive stacktraces in VisualVM to find what to optimize and how. The amount of code is about the same at either end. On Thursday, February 21, 2013 10:41:55 AM UTC+1, Christophe Grand wrote: I updated my answer on SO, with a deftype-based one that gives me an additional 30% boost. Whatever the final performance achieved, the fact remains that the original Java code was much cleaner, simpler, and more comprehensible than the big ball of mud the performant Clojure version is turning into. I have my own piece of performance-critical code that I used to maintain and improve over a timespan of many months. I finally gave in and recoded the thing in Java. It took only a couple of hours and the result was nice, clean, idiomatic Java code, with completely predictable performance characteristics, as opposed to the Clojure version where it took many hours of staring at ridiculuously counterintuitive stacktraces in VisualVM to find what to optimize and how. The amount of code is about the same at either end. On Thursday, February 21, 2013 10:41:55 AM UTC+1, Christophe Grand wrote: I updated my answer on SO, with a deftype-based one that gives me an additional 30% boost. On Tue, Feb 19, 2013 at 6:38 PM, Geo ggrig...@gmail.com wrote: What about the call to .equals? On Tuesday, February 19, 2013 12:20:28 PM UTC-5, Marko Topolnik wrote: The difference between String[] and Object[] is that a member of the former doesn't need a checked cast to String, but the latter does need one. In the code under consideration, however, nothing specific to String is used, so even in the Java code you can freely replace String[] with Object[] and everything still works. If, on the other hand, you needed to invoke say *substring*, you'd see a small penalty due to the checked cast operation. On Tuesday, February 19, 2013 5:52:31 PM UTC+1, Andy Fingerhut wrote: ^objects is a Clojure synonym for ^[Ljava.lang.Object;. Note that there are such synonyms for only a few Java types, not everything, e.g. there is no ^strings. What you are hinting is that a1 and a2 are Java arrays of objects. I think this might speed up (aget a1 i) expressions, since it is known that a1 is an array of objects, but I'm not sure about that. I believe under the hood in the JVM all arrays of Objects are treated the same, regardless of whether those Objects are String, Integer, java.awt.Color, etc. Andy On Feb 19, 2013, at 8:46 AM, Geo wrote: One thing I don't get is that switching the type hints from [#^[Ljava.lang.String; a1 #^[Ljava.lang.String; a2] to [^objects a1 ^objects a2] didn't seem to have any negative impact on performance. Can anyone explain why hinting ^objects is just as good as specifying that it's an array of Strings? What are you hinting with ^objects that Clojure doesn't already know? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@**googlegroups.com For more options, visit this group at
ANN: MPEdn, an EDN reader/writer for OS X and iOS
Hello all, just letting anyone who might be interested know that I've posted MPEdn, an EDN reader/writer implementation for OS X and iOS: https://github.com/scramjet/mpedn It's in active use in a project of mine, so I'm going to go ahead and claim it's a stable and useful 1.0 release. Feedback otherwise, or comments welcome. Cheers, Matthew. -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Domina API: value vs. text
I've been playing around with Domina; I'm curious why there are different functions for getting the value of forms and of text nodes, (value ) and (text ) respectively. (I realize this comes from JQuery, and I'm a comparative Web noob.) I also noticed that the various set! functions operate on plural nodes, whereas the get functions will only operate on a single node. This is a little surprising. -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: nREPL + Emacs: How to get new definitions to load reliably?
Being *x* is the function you use for switching between buffers, one can add a hook to *x* that will perform a nrepl-eval-ns-form, or more sophisticated stuff like adding a :reload clause, sending the ns form to the nrepl console as well, etc. -- -- 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 from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.