Re: println from within a thread

2010-11-21 Thread Aaron Cohen
Does anybody know how to redirect the output into the repl? I actually think the preferred way of doing this is M-x slime-redirect-inferior-output or adding to your .emacs: (add-hook 'slime-mode-hook 'slime-redirect-inferior-output) -- You received this message because you are subscribed

Re: Documentation lacking for ns macro

2010-11-05 Thread Aaron Cohen
On Thu, Nov 4, 2010 at 2:41 PM, Ken Wesson kwess...@gmail.com wrote: clojure.core/use ([ args])  Like 'require, but also refers to each lib's namespace using ... Yeah, that's a real help if you're trying to remember the syntax. args. How specific. :) You stopped one indirection short,

Re: Setting Clojure “constants” at runtime (cros sposted to Stackoverflow)

2010-10-25 Thread Aaron Cohen
On Sat, Oct 23, 2010 at 8:53 AM, Ralph grkunt...@gmail.com wrote: Won't work. The def gets executed at compile time, before the JAR file exists. I'm very confused by what you mean by this. If I do the following, I get a new random value every time I run it, which does not seem to match what

Re: clojure-contrib master now in submodules

2010-09-09 Thread Aaron Cohen
On Thu, Sep 9, 2010 at 6:43 PM, Brian Carper briancar...@gmail.com wrote: On Sep 9, 3:13 pm, Stuart Sierra the.stuart.sie...@gmail.com wrote: Can you clarify?  Maven-aware build tools (e.g. Leiningen) should not be trying to downlaod the clojure-contrib:complete JAR file. Instead, referencing

Re: git clone Clojure/Maven?

2010-08-22 Thread Aaron Cohen
Maven isn't really analogous to git for the most part. Having a complete history of a source code repository isn't a big deal thanks to delta compression; keeping a complete history of every artifact ever built would just be colossal. One helpful tip though, is: mvn dependency:go-offline That

Re: IDE agnostic question on user assistance (emacs/vimClojure users help appreciated too !)

2010-07-22 Thread Aaron Cohen
On Wed, Jul 21, 2010 at 9:33 AM, Meikel Brandmeyer m...@kotka.de wrote: Hi, On Jul 21, 1:35 pm, Jeff Rose ros...@gmail.com wrote: Really, there isn't a way to start processes from VIM? How about just opening a temporary buffer for the output of the nailgun server, and then start it

Should max and min have 0-arg implementations?

2010-07-09 Thread Aaron Cohen
I noticed that http://clojure-examples.appspot.com/clojure.core/max has both (apply max [1 2 3 4]) - 4 and (max []) - [] (which I think is a poor example). However, when attempting to add another example for (apply max []) which I expected to return nil, that instead it throws an exception. I

Re: Benchmarking clojure code

2010-07-01 Thread Aaron Cohen
If nothing else adding code to measure the empty loop and punting if the difference between that and the code loop is statistically insignificant would seem like a good idea. It's actually notoriously hard to time the empty loop on the JVM. Once you've iterated a few thousand times, the JIT

Re: New Primitive data types (equal branch) - impact on optimized code.

2010-06-28 Thread Aaron Cohen
Doing these tests on clojure 1.1, while self-enlightening, is kind of missing the point. The current primitive work on master for 1.2 are trying to make optimizing more practical, possible and less ugly. It's well known that 1.1 optimization is ugly at best and often not completely successful.

Re: Enhanced Primitive Support

2010-06-19 Thread Aaron Cohen
On Sat, Jun 19, 2010 at 11:22 PM, Mike Meyer mwm-keyword-googlegroups.620...@mired.org wrote: Rob Lachlan robertlach...@gmail.com wrote: Actually, Mike, your two functions work just fine.  (Equal branch). Mind you I checked that out over two hours ago, so this information might be out of date.

Re: Enhanced Primitive Support

2010-06-18 Thread Aaron Cohen
I've also temporarily enabled a diagnostic (in both) that tells you when you have a mismatch between a loop initializer and its recur form. It goes off over a hundred times in Clojure itself, when using the arbitrary precision default. In each case, the recur value is needlessly being boxed,

Re: java -server

2010-06-03 Thread Aaron Cohen
This error indicates that your java executable is coming from the JRE rather than the JDK. On windows, the JRE only includes the client virtual machine. If you have the JDK already installed on your computer, switch your JAVA_HOME and PATH to use it instead, and try it again. -- You received

Re: No matching method found for javax.mail.internet.MimeMessage

2010-05-27 Thread Aaron Cohen
Judging from the javadoc, setRecipients takes an array of addressses as its second parameter. So try (into-array to), (into-array for), 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

Re: Should repeatedly defining the same protocol in a file work?

2010-05-25 Thread Aaron Cohen
This seems to have been fixed in master at some point. -- 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

Should repeatedly defining the same protocol in a file work?

2010-05-22 Thread Aaron Cohen
(I tried to post this to clojure-dev, but don't have permission to post messages there) At a repl the following works: (defprotocol Base  (foo [o])) (defprotocol Base) (defprotocol Base  (foo [o])) However, a file containing only those three forms, causes the following when loaded: loader

defn allows overwriting Protocol function without notification

2010-05-22 Thread Aaron Cohen
user= (defn foo [_] foo) user= (defprotocol IFoo (foo [_])) Warning: protocol #'user/IFoo is overwriting function foo IFoo user= (extend-protocol IFoo nil (foo [_] IFoo)) nil user= (foo nil) IFoo user= (foo 1) java.lang.IllegalArgumentException: No implementation of method: :foo

defn allows overwriting Protocol function without notification

2010-05-22 Thread Aaron Cohen
user= (defn foo [_] foo) user= (defprotocol IFoo             (foo [_])) Warning: protocol #'user/IFoo is overwriting function foo IFoo user= (extend-protocol IFoo nil (foo [_] IFoo)) nil user= (foo nil) IFoo user= (foo 1) java.lang.IllegalArgumentException: No implementation of method: :foo of

Re: defn allows overwriting Protocol function without notification

2010-05-22 Thread Aaron Cohen
Sorry for the duplicate messages. -- 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

str and *print-length* interaction intentional?

2010-05-19 Thread Aaron Cohen
Hi, I realize that at some level, str is just calling toString so the behaviour isn't really defined. I find the following surprising though because str doesn't obviously involve printing: user= (binding [*print-length* 1] (str '(1 2 3 4))) (1 ...) This is because ASeq.toString delegates to

Re: Bug - Clojure -e disables stdin

2010-04-16 Thread Aaron Cohen
This is actually a fairly good bug report, I think. If you look in clojure.main, the eval-opt fuction uses with-in-str, which unnecessarily interferes with using *in* within the expression you are trying to evaluate. I was actually running into this while trying to make a lein repl in clojure

Re: New clojure support in Polyglot Maven

2010-04-08 Thread Aaron Cohen
On Thu, Apr 8, 2010 at 4:57 PM, Armando Blancas armando_blan...@yahoo.com wrote: Looks cool. This should help the XML-allergic :) Though I don't like it, the XML is the least of my problems. Don't know what to do or even where to start. I want to do the following in maven or pmaven, but

Re: Can I GPL my Clojure project?

2010-03-29 Thread Aaron Cohen
If you're distributing the jar file you own copyright to it and you can grant any kind of permissions you want. So you may need to grant your user's explicit permission to link your code against specific jars (such as Clojure and Clojure-Contrib), but it's hardly impossible. The GPL v3 has a

Rich's Clojure in Clojure talk at the NYC group

2010-02-02 Thread Aaron Cohen
Hi guys,   I was watching the Clojure in Clojure talk that I saw linked from the disclojure blog (very useful to me by the way, thank you nameless to me person who does it -- Aaron -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group,

Re: Rich's Clojure in Clojure talk at the NYC group

2010-02-02 Thread Aaron Cohen
This email was cut-off from what I intended to send, sorry. What I meant to say, was that, unfortunately the video cuts off after 10 minutes. Are the slides for this talk available somewhere? Thanks, Aaron On Feb 2, 3:44 pm, Aaron Cohen remled...@gmail.com wrote: Hi guys,   I was watching

Re: Sequence to Vector

2010-01-03 Thread Aaron Cohen
What JVM 6 sub-version are you using? Does it make any difference if you specify -XX:+DoEscapeAnalysis at the command line? Various JVM 6 sub-versions enable and disable it by default and it can make a pretty hefty difference if it isn't enabled. -- Aaron On Sun, Jan 3, 2010 at 4:00 PM, Gabi

Re: Space usage of lazy seqs

2009-12-03 Thread Aaron Cohen
On Thu, Dec 3, 2009 at 9:13 AM, Johann Hibschman joha...@gmail.com wrote: On Dec 2, 9:59 pm, Johann Hibschman joha...@gmail.com wrote: On Dec 2, 9:09 pm, David Brown cloj...@davidb.org wrote: You can tune the max with -Xmx1G for example, to limit it to one GB. That's a good idea; then I'll

Re: Newbie - the method I cannot call

2009-08-25 Thread Aaron Cohen
Isn't the audio part of the JDK something that Sun wasn't able to open source because of licensing issues? I recall that openjdk had issues in that area initially at least, I haven't looked recently. -- Aaron --~--~-~--~~~---~--~~ You received this message

Re: ANN: clojure-contrib automatic documentation system complete

2009-08-25 Thread Aaron Cohen
Looks really nice Tom! Wouldn't it be better to make the words API documentation the link rather than adding the extra valueless word here? Alternatively, you could turn the namespace titles into links and get rid of the line words API documentation here entirely. That might also help google

Re: Pure-functional N-body benchmark implementation

2009-08-18 Thread Aaron Cohen
On Tue, Aug 18, 2009 at 11:28 AM, Brad Beveridgebrad.beveri...@gmail.com wrote: On 2009-08-17, at 8:58 PM, FFT fft1...@gmail.com wrote: On Mon, Aug 17, 2009 at 9:25 AM, Bradbevbrad.beveri...@gmail.com wrote: Ah, that makes more sense re the cheating then.  Your insight for array range

Re: Pure-functional N-body benchmark implementation

2009-08-18 Thread Aaron Cohen
On Tue, Aug 18, 2009 at 3:32 PM, Aaron Cohenremled...@gmail.com wrote: On Tue, Aug 18, 2009 at 11:28 AM, Brad Beveridgebrad.beveri...@gmail.com wrote: On 2009-08-17, at 8:58 PM, FFT fft1...@gmail.com wrote: On Mon, Aug 17, 2009 at 9:25 AM, Bradbevbrad.beveri...@gmail.com wrote: Ah, that

Re: Pure-functional N-body benchmark implementation

2009-08-17 Thread Aaron Cohen
On Mon, Aug 17, 2009 at 7:45 PM, Mark Engelbergmark.engelb...@gmail.com wrote: On Mon, Aug 17, 2009 at 9:25 AM, Bradbevbrad.beveri...@gmail.com wrote: I found another 2-3x speed up by coercing the indexes with (int x), ie (defmacro mass [p] `(double (aget ~p (int 0 Which makes me

Re: Request for Discussion: user created reader macros

2009-08-13 Thread Aaron Cohen
On Thu, Aug 13, 2009 at 5:14 PM, Meikel Brandmeyerm...@kotka.de wrote: Hi, Am 13.08.2009 um 22:30 schrieb Brian Hurt: Now, I can certainly see a lot of potiential downsides to this.  Redefining what #{} or #() means is just the start. I think, this is the reason Rich is not very positive

Re: Request for Discussion: user created reader macros

2009-08-13 Thread Aaron Cohen
On Thu, Aug 13, 2009 at 5:23 PM, Aaron Cohenremled...@gmail.com wrote: On Thu, Aug 13, 2009 at 5:14 PM, Meikel Brandmeyerm...@kotka.de wrote: Hi, Am 13.08.2009 um 22:30 schrieb Brian Hurt: Now, I can certainly see a lot of potiential downsides to this.  Redefining what #{} or #() means is

Re: Clojure, Java JIT, and inlining

2009-08-12 Thread Aaron Cohen
On Wed, Aug 12, 2009 at 3:59 PM, Richard Newmanholyg...@gmail.com wrote: Is there some reason that the Java JIT is not doing this, with the original code using defn, as fast as it works when using defmacro? The macro expands into bytecode within the same Java method, rather than a method

Re: Clojure, Java JIT, and inlining

2009-08-12 Thread Aaron Cohen
On Wed, Aug 12, 2009 at 4:24 PM, Richard Newmanholyg...@gmail.com wrote: I may be wrong, but doesn't a typical function invocation involve dereferencing the Var holding the object that implements IFn and calling invoke?  It seems pretty intuitive to me that this would be difficult to inline

Re: Pure-functional N-body benchmark implementation

2009-08-12 Thread Aaron Cohen
I'm getting a very significant performance improvement by adding a couple of JVM parameters (using jdk 1.6.0_14). They are: -XX:+DoEscapeAnalysis -XX:+UseBiasedLocking (I think the -server flag is required for those two flags to do anything). My runtime with n = 5,000,000 goes from ~7.5 seconds

Re: Pure-functional N-body benchmark implementation

2009-08-12 Thread Aaron Cohen
On Wed, Aug 12, 2009 at 4:49 PM, Aaron Cohenremled...@gmail.com wrote: I'm getting a very significant performance improvement by adding a couple of JVM parameters (using jdk 1.6.0_14).  They are: -XX:+DoEscapeAnalysis -XX:+UseBiasedLocking (I think the -server flag is required for those two

Re: Pure-functional N-body benchmark implementation

2009-08-11 Thread Aaron Cohen
On Tue, Aug 11, 2009 at 5:26 PM, Andy Fingerhutandy_finger...@alum.wustl.edu wrote: In case it matters to anyone, my intent in creating these Clojure programs to compare their speed to others isn't to try to rip into Clojure, or start arguments.  It is for me to get my feet wet with Clojure,

Re: Pure-functional N-body benchmark implementation

2009-08-11 Thread Aaron Cohen
On Tue, Aug 11, 2009 at 8:13 PM, Andy Fingerhutandy_finger...@alum.wustl.edu wrote: On Aug 11, 2:36 pm, Aaron Cohen remled...@gmail.com wrote: At that point is it possible you're just paying the price of PersistentVector for the bodies vector?  Does it improve much if you change bodies

Re: Trampolined backtracking maze solver

2009-08-03 Thread Aaron Cohen
On Sun, Aug 2, 2009 at 3:28 PM, John Harrop jharrop...@gmail.com wrote: On Sun, Aug 2, 2009 at 5:48 AM, James Sofra james.so...@gmail.com wrote: (defn get-tile [[x y] maze] (if (tile-in-bounds? [x y] maze) ((maze y) x))) (defn get-tile [[x y] maze] (get (get maze y) x)) While

Re: Idiomatic parsing of objects from several lines of a text file

2009-07-31 Thread Aaron Cohen
I think it's MY C++ background shining through, but I keep reading (ref-commit) as execute the commit method of the ref datastructure. I'll have to echo the lack of enthusiasm of inputting fancy characters, though the Emacs mode to prettify the display look interesting. Good luck with the

Re: Possible bug report

2009-07-30 Thread Aaron Cohen
At my day job, we've always used a custom classloader to get around that asymmetry. -- Aaron On Thu, Jul 30, 2009 at 9:51 AM, Rich Hickey richhic...@gmail.com wrote: On Jul 29, 6:09 pm, Jason Wolfe jawo...@berkeley.edu wrote: Is this a bug? user (eval `(make-array ~Byte/TYPE 2)) ;

Re: Idiomatic parsing of objects from several lines of a text file

2009-07-30 Thread Aaron Cohen
What is this convention you are using with the - ? Are you coming from a C or C++ background or is this something lispy I haven't seen before? -- Aaron On Thu, Jul 30, 2009 at 7:56 PM, Richard Newman holyg...@gmail.com wrote: On 30 Jul 2009, at 2:26 PM, David Plumpton wrote: I'm trying to

Re: Clojure performance tests and clojure a little slower than Java

2009-07-27 Thread Aaron Cohen
One thing you need to do is define what you mean exactly when you say Java vs Clojure. In your example you are comparing clojure code vs java code but you are also comparing clojure data structures (PersistentMap) with traditional Java data structures (HashMap). I'm not sure you meant to conflate

Thread local data structures

2009-07-27 Thread Aaron Cohen
What kind of infrastructure would it take to do something like Escape Analysis in the clojure compiler? It seems to me that it should be possible for something (the clojure compiler?, a new JIT of some sort?) to notice that a data structure is being used in a thread-local manner, and use that

Re: Clojure performance tests and clojure a little slower than Java

2009-07-27 Thread Aaron Cohen
is comparable. For example, lets say the Euler problem number 1 wants you want to return a result of 123. The end result is 123, if I write code in Java and then in Clojure, I want to see the runtimes of the different versions. On Jul 27, 1:34 pm, Aaron Cohen remled...@gmail.com wrote

Re: Thread local data structures

2009-07-27 Thread Aaron Cohen
in only one thread, you have to check that there's never a reference to an older version. You could theoretically re-implement the Persistent List/Map/Set interfaces with mutable implementations, but I don't know where to go from there. -SS On Jul 27, 1:37 pm, Aaron Cohen remled

Re: Performance question (newbie)

2009-07-15 Thread Aaron Cohen
Another note is that these kind of micro-benchmarks are a little difficult to do correctly in most modern VMs, including Hotspot. In particular, the kind of tight loop you're doing there where the result isn't used can sometimes be optimized away by the JIT to go infinitely fast. A pretty good

Re: another binding issue?

2009-07-14 Thread Aaron Cohen
I'm a little unclear on why this happens still. #(= % a) is a closure, correct? My understanding is that this should capture the environment when it is defined. Why does the environment not include the current bindings? -- Aaron On Tue, Jul 14, 2009 at 4:03 PM, Mark Engelberg

Re: EDT interaction

2009-06-13 Thread Aaron Cohen
Isn't this a case of wrapping a Java API needlessly? What's so bad about: (SwingUtilities/invokeLater my-func) ? -- Aaron On Sat, Jun 13, 2009 at 5:59 PM, Kevin Downeyredc...@gmail.com wrote: On Sat, Jun 13, 2009 at 2:55 PM, Meikel Brandmeyerm...@kotka.de wrote: Hi, Am 13.06.2009 um

Re: Contributing tests

2009-06-04 Thread Aaron Cohen
It's a great idea, and already in progress. ;) http://code.google.com/p/clojure-contrib/source/browse/#svn/trunk/src/clojure/contrib/test_clojure -- Aaron On Thu, Jun 4, 2009 at 12:31 PM, Richard Newman holyg...@gmail.com wrote: One of the things that occurred to me at last night's Meetup

Re: I need help tracking down a performance problem.

2009-03-31 Thread Aaron Cohen
I'm sorry if I missed you mentioning it, but have you tried running your code with (set! *warn-on-reflection* true) in effect? -- Aaron --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this

Re: I need help tracking down a performance problem.

2009-03-31 Thread Aaron Cohen
On Tue, Mar 31, 2009 at 1:24 PM, Aaron Cohen remled...@gmail.com wrote: I'm sorry if I missed you mentioning it, but have you tried running your code with (set! *warn-on-reflection* true) in effect? Ugh, I should have looked at your code before I sent that. There it is on line 1

Re: Designing a Performance Vector Math library in Clojure.

2009-01-13 Thread Aaron Cohen
user= (defstruct desilu :fred :ricky) #'user/desilu user= (def x (map (fn [n] (struct-map desilu :fred n :ricky 2 :lucy 3 :ethel 4)) (range 100))) #'user/x user= (time (reduce (fn [n y] (+ n (:fred

Why allow both ({:map 'example} :map) and (:map {:map 'example})?

2008-12-11 Thread Aaron Cohen
Isn't it just asking for confusion? I really like that maps are functions of their keys though. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

<    1   2   3