Re: Enhanced Primitive Support

2010-06-23 Thread John Williams
On Sat, Jun 19, 2010 at 5:41 AM, Heinz N. Gies he...@licenser.net wrote: Lets get away from the argument already cast and bring a new one. It is an impossible situation that the literal 1 in one place has a different meaning and behavior then in another place. This is in fact a show stopper,

Re: clojure.contrib.logging in side-effect free functions?

2010-06-23 Thread John Williams
When the docs say not to use side-effects in a function or block of code, they're not saying you can't use side-effects at all; it's just a reminder that using side-effects can cause nasty surprises for one or more of these reasons: 1. The code may be evaluated later than you expect. 2. It might

How I learned to stop worrying and love condp

2010-05-21 Thread John Williams
I was in to process of writing a rant against condp when I realized I had been thinking about it all wrong. Here is what I wanted at first: (defmacro casep [pred clauses] `(condp #(%2 %1) ~pred ~...@clauses)) In other words, I want to be able to specify a unary predicate instead of a binary

Re: mutating multiple java swing components

2010-04-09 Thread John Williams
This is how I would write it: (doseq [[main fixed] (map vector mainTables fixedTables)] (println Setting up table) (doto fixed (.setAutoCreateColumnsFromModel false) (.setModel (.getModel main)) (.setSelectionModel (.getSelectionModel main)) (.setFocusable false)) (let

Re: mutating multiple java swing components

2010-04-08 Thread John Williams
It sounds like the doseq is the macro you're looking for, e.g. (doseq [c my-components] (.setVisible c true)) On Thu, Apr 8, 2010 at 5:07 PM, strattonbrazil strattonbra...@gmail.comwrote: What's the function to call java code on multiple java components? If I have a sequence of Java swing

Re: How to efficiently import large array of doubles from file?

2010-02-22 Thread John Williams
The overhead of using a Clojure vector will be a little more than 2.5x on a 32-bit Sun JVM, because each Java object has an 8-byte overhead, and storing references to those objects in a Clojure vector will use just over 4 bytes per object. I'm not sure what the figure would be for a 64-bit JVM,

Re: newbie question: Please help me stop creating constructors

2010-02-19 Thread John Williams
? Wouldn't they be invisible to me and the test framework which would only see sell-or-rent? On Feb 18, 4:27 pm, John Williams j...@pobox.com wrote: I'm no Clojure guru myself, but one approach you may want to consider is nest all your auxiliary functions inside the main function, and use

Re: newbie question: Please help me stop creating constructors

2010-02-18 Thread John Williams
I'm no Clojure guru myself, but one approach you may want to consider is nest all your auxiliary functions inside the main function, and use ordinary let-bindings the same way you've been trying to use global bindings: (defn sell-or-rent [{:keys [supplied-1 supplied-2]}] (let [derived-1 (+ 1

Re: error reporting for macro expansion

2010-02-11 Thread John Williams
I'm concerned specifically about exceptions that occur during macro expansion. As often as not, these exceptions are the result of calling the macro with incorrect arguments rather than any problem in the macro itself, but the stack trace doesn't contain enough information to locate the offending