Re: CLJOS - Spinoza, 3X faster than struct-map ;)

2009-02-06 Thread mikel
On Feb 6, 12:18 am, David Nolen dnolen.li...@gmail.com wrote:   (prefer-method frob ::idea ::thing) (prefer-method [::runtime-tag1 ::idea] [::runtime-tag1 ::thing]) (prefer-method [::runtime-tag2 ::thing] [::runtime-tag2 ::idea]) Provide a dispatch fn that extracts the runtime tag.

Question about clojure.lang.Compiler.writeClassFile()

2009-02-06 Thread Laurent PETIT
Hello, I have a problem for implementing the auto-compile feature of clojuredev eclipse plugin. My problem is that it seems that the function 'compile returns very fast to the clojure dev builder, and when the builder refreshes the workspace (operation needed to see the newly compiled classes),

Re: Newbie: Trying to defer evaluation of unbound variable arguments until needed with macros

2009-02-06 Thread Christophe Grand
hello, samppi a écrit : I tried asking about this yesterday, but it seems like I expressed my problem poorly. Anyways, here's another shot. :) (declare value) (def array (conc array-start value array-sep value array-end)) (def value (alt array bit)) You can get your code to work by

Re: Map from generator?

2009-02-06 Thread Albert Cardona
Rich Hickey wrote: On Feb 4, 10:36 pm, Conrad drc...@gmail.com wrote: It is useful to build a map from a list of keys and a value generator function. Of Course, such a function is easy to write: (defn genmap [keys fun] (zipmap keys (map fun keys))) In fact, it seems so useful that

Re: A short guide on how to use NetBeans to create GUI and then use this GUI from clojure available

2009-02-06 Thread Emeka
Tim You could even embed a REPL into your application with a socket back-door, connect to it and really have fun with your users. I am interested, could you make a rough patch for me to draw some inspiration from Emeka --~--~-~--~~~---~--~~ You received this

Re: Denver/Boulder Clojure users

2009-02-06 Thread humanzee
I'm in Colorado Springs. I'm pretty new to Clojure, but totally sold on it. On Feb 5, 12:39 pm, chris cnuern...@gmail.com wrote: Are there any existing clojure users in the Denver/Boulder area (other than me)?. Chris --~--~-~--~~~---~--~~ You received this

Re: Issue request: RT.load's don't load if already loaded mechanism breaks :reload-all

2009-02-06 Thread Stephen C. Gilardi
On Feb 6, 2009, at 8:28 AM, Stephen C. Gilardi wrote: When *reload-all* is true, RT.load() will (re)load all libs from their .clj files even if they're already loaded. To clarify: When *reload-all* is true, RT.load will (re)load any lib it is asked to load from the lib's .clj file even

Re: Issue request: RT.load's don't load if already loaded mechanism breaks :reload-all

2009-02-06 Thread Laurent PETIT
Hello, Does it also mean that the following use case will work with *reload-all* : - x.y.z is a lib that is made of two files : x/y/z.clj, and x/y/z1.clj , and z.clj loads z1.clj - x.y.z is compiled - z1.clj is modified - x.y.z is compiled = even if x/y/z.clj nor x/y/z__init.class are in sync,

Re: What profilers are you using?

2009-02-06 Thread Peter Wolf
Hi Sergio, I have been using JProfiler with the IntelliJ Clojure plugin. The combination seems to work fine, except that JProfiler does not know how to display Clojure source code associated with a function. However, there is enough information displayed that you can do it trivially. Peter

Re: assert-args private?

2009-02-06 Thread Jeffrey Straszheim
I'd vote for that -- after the powers that be are happy with a name. It would be very useful to me. On Fri, Feb 6, 2009 at 9:43 AM, Chouser chou...@gmail.com wrote: On Thu, Feb 5, 2009 at 3:08 PM, Jeffrey Straszheim straszheimjeff...@gmail.com wrote: Is there a reason the assert-args macro

What profilers are you using?

2009-02-06 Thread Sergio
I have been trying out the YourKit profiler and I think it's great. However, my evaluation license is going to expire soon and being a student I can't purchase (even the academic) license right now. I have tried profiler4j and it is usable but it isn't working 100% right with clojure (in my

Issue request: RT.load's don't load if already loaded mechanism breaks :reload-all

2009-02-06 Thread Stephen C. Gilardi
require and use support a :reload-all flag that is intended to cause the specified libs to be reloaded along with all libs on which they directly or indirectly depend. This is implemented by temporarily binding a loaded-libs var to the empty set and then loading the specified libs. AOT

Re: Tools for parsing arguments

2009-02-06 Thread Kevin Downey
you can also use map destructuring. (defn x [{:keys [a b c]}] [a b c]) user= (x {:a 1 :b 2 :c 3}) [1 2 3] On Fri, Feb 6, 2009 at 7:52 AM, Jeffrey Straszheim straszheimjeff...@gmail.com wrote: That is remarkably simple and elegant. On Fri, Feb 6, 2009 at 10:20 AM, Stuart Sierra

Re: Tools for parsing arguments

2009-02-06 Thread Christophe Grand
Stuart Sierra a écrit : No, but there is a pattern for keyword args: (defn my-function [ args] (let [options (apply hash-map args)] ...)) Then you can call (my-function :keyword value :keyword2 value) And you can use destructuring to add support for defaults value: (defn my-function

Re: Newbie: Trying to defer evaluation of unbound variable arguments until needed with macros

2009-02-06 Thread Christophe Grand
Christophe Grand a écrit : (def array (delay (conc array-start value array-sep value array-end))) or: (def array (conc array-start (delay value) array-sep (delay value) array-end)) and you don't need the call-rule helper. --~--~-~--~~~---~--~~ You

Re: android app development with clojure

2009-02-06 Thread Remco van 't Veer
Got startup time down to 5 seconds by completely eliminating the use of lispreader and putting of loading the xml, set and zip namespaces. There's no clear bottlenecks left to fix. On Fri, Feb 6, 2009 at 1:06 AM, Remco van 't Veer rwvtv...@gmail.com wrote: I've managed to get to startup time

Re: Newbie: Trying to defer evaluation of unbound variable arguments until needed with macros

2009-02-06 Thread samppi
Thanks for the reply. I've tried delays, but it seemed to make my functions much slower. I think I'm going to go with var-quoting—it seems to be the least intrusive option, and it definitely works. My nightmare is finally over. :) I wonder if there's a way to make a macro make even this unneeded

Re: android app development with clojure

2009-02-06 Thread Sean Spencer
I looked into this briefly; I'm amazed at the progress you've made. Please keep updating! On Fri, Feb 6, 2009 at 11:29 AM, Remco van 't Veer rwvtv...@gmail.comwrote: Got startup time down to 5 seconds by completely eliminating the use of lispreader and putting of loading the xml, set and zip

Sudoku solver with GUI

2009-02-06 Thread Tzach
Hi all As my first Clojure project, I decided to finally solve one of humanity major problems - Sudoku! Here is the source http://code.google.com/p/sudoku-solver/source/browse/trunk/sudoku-solver.clj I would appreciate your comments. Thanks Konrad for useful tips. What is the simplest way to

Re: Newbie: Trying to defer evaluation of unbound variable arguments until needed with macros

2009-02-06 Thread Christophe Grand
samppi a écrit : Thanks for the reply. I've tried delays, but it seemed to make my functions much slower. I think I'm going to go with var-quoting—it seems to be the least intrusive option, and it definitely works. My nightmare is finally over. :) I wonder if there's a way to make a macro

Re: proposal for shell-out: option to return articulated out, err, exit code

2009-02-06 Thread Perry Trolard
I've updated this patch, eliminating the performance hit I introduced for concatenation of stdout stderr when they're byte arrays (turns out it was significant). Let me know if there's anything else I can do. Perry http://code.google.com/p/clojure-contrib/issues/detail?id=23

Re: How to write a unicode character in clojure?

2009-02-06 Thread Tom Faulhaber
You can also provide the unicode directly to the reader with \u, e.g., \u0426. On Feb 4, 11:24 pm, Terrence Brannon metap...@gmail.com wrote: How do you write a unicode character in clojure? Or properly put: what form do you provide the reader so that it produces a unicode character as

Re: Map from generator?

2009-02-06 Thread Jason Wolfe
(defn mash   Reduce a seq-able to a map. The given fn should return a 2-element tuple   representing a key and value in the new map.   [f coll]   (reduce     (fn [memo elem]       (let [[k v] (f elem)]         (assoc memo k v)))     {} coll)) I called this map-map in my utilities. Mine

Re: What profilers are you using?

2009-02-06 Thread Jason Wolfe
+1 for the EAP of YourKit. It will expire every now and then, but you just download the new version. The only problem I have is that as far as I can figure out, it can't display source code associated with a function either. This is usually fine, except for that it can be impossible to figure

General form of apply

2009-02-06 Thread Konrad Hinsen
The doc string of apply says: ([f args* argseq]) Applies fn f to the argument list formed by prepending args to argseq. This looks like I could pass in several argument PLUS one sequence of arguments, which just happens to be what I want in a specific case. But it doesn't

Re: General form of apply

2009-02-06 Thread Shawn Hoover
On Fri, Feb 6, 2009 at 1:19 PM, Konrad Hinsen konrad.hin...@laposte.netwrote: The doc string of apply says: ([f args* argseq]) Applies fn f to the argument list formed by prepending args to argseq. This looks like I could pass in several argument PLUS one sequence of

PATCH: add warn-on-reflection option to c.l.Compile

2009-02-06 Thread Chas Emerick
Attached is a patch to add a warn-on-reflection option to clojure.lang.Compile. In short, if the clojure.compile.warn-on- reflection system property is set to true, then *warn-on-reflection* is set to true for the duration of the compile process for the libs specified as command line args.

Re: PATCH: add warn-on-reflection option to c.l.Compile

2009-02-06 Thread Rich Hickey
On Feb 6, 2009, at 1:33 PM, Chas Emerick wrote: Attached is a patch to add a warn-on-reflection option to clojure.lang.Compile. In short, if the clojure.compile.warn-on- reflection system property is set to true, then *warn-on-reflection* is set to true for the duration of the compile

Clojure Maps and Java Maps

2009-02-06 Thread Peter Wolf
Hello, how do I do this elegantly? I have a Clojure Map = {:foo foo :bah 3 ... } and I need to pass it to a Java method that is expecting a MapString,Object = { foo -- foo , bah -- 3 ...} How does one convert a Clojure Map to the equivalent Java Map? I bet I could do it in one line if I

Re: PATCH: add warn-on-reflection option to c.l.Compile

2009-02-06 Thread Chas Emerick
Done: http://code.google.com/p/clojure/issues/detail?id=67 Sorry, I'm not with it yet on the new Google Code workflow. :-) - Chas On Feb 6, 1:53 pm, Rich Hickey richhic...@gmail.com wrote: On Feb 6, 2009, at 1:33 PM, Chas Emerick wrote: Attached is a patch to add a warn-on-reflection

Re: Clojure Maps and Java Maps

2009-02-06 Thread Jason Wolfe
AFAIK no conversion may be necessary, since Clojure maps are Java maps. user (instance? java.util.Map {:foo foo :bah 3}) true The only exception would be if your method expects a mutable map. In that case, user (HashMap. {:foo foo :bah 3}) #HashMap {:foo=foo, :bah=3} -Jason On Feb 6,

Re: Clojure Maps and Java Maps

2009-02-06 Thread Christophe Grand
hello Peter Wolf a écrit : Hello, how do I do this elegantly? I have a Clojure Map = {:foo foo :bah 3 ... } and I need to pass it to a Java method that is expecting a MapString,Object = { foo -- foo , bah -- 3 ...} How does one convert a Clojure Map to the equivalent Java Map? I bet I

Re: Clojure Maps and Java Maps

2009-02-06 Thread Jason Wolfe
Oops, missed the String key part -- go with Christophe's answer, perhaps coupled with the second half of mine. -Jason --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email

Re: Question about clojure.lang.Compiler.writeClassFile()

2009-02-06 Thread Laurent PETIT
Hello, I could test the patch, it works really well. With it, no need to implement periodic polling, which is really a bad solution when on e can avoid it! Still don't know if there could be a performance impact that would require to have this as an optional behaviour. Rich, please do you think

Re: What profilers are you using?

2009-02-06 Thread Sergio
Thanks! I hadn't seen the EAP option =) I'm going to go with that. On Feb 6, 11:57 am, Jason Wolfe jawo...@berkeley.edu wrote: +1 for the EAP of YourKit.  It will expire every now and then, but you just download the new version. The only problem I have is that as far as I can figure out, it

Curious about the order of hash destructuring

2009-02-06 Thread Jeffrey Straszheim
So, I notice that when you create a hash you do this: { :key-1 value-1 :key-2 value-2 ... etc ... } But when you destructure a hash, you do this: { formal-1 :key-1 formal-2 :key-2 ... etc ... } Is there a reason the order is reversed? --~--~-~--~~~---~--~~ You

Re: General form of apply

2009-02-06 Thread Konrad Hinsen
On 06.02.2009, at 19:22, Shawn Hoover wrote: This seems to work correctly: user (apply + 1 2 3 [4 5]) 15 Is that what you're looking for? Exactly - except that it doesn't work for me! Konrad. --~--~-~--~~~---~--~~ You received this message because you are

What type of arguments are passed to a macro exactly?

2009-02-06 Thread CuppoJava
Hi, I'm trying to write a macro that outputs a symbol without attempting to resolve it and would appreciate some pointers. eg. I wrote a function that accepts a symbol as an argument (defn print_symbol [a] (println a)) which can be called like this: (print_symbol 'mysymbol) But I want to

Re: What type of arguments are passed to a macro exactly?

2009-02-06 Thread Laurent PETIT
(defmacro print_symbol [s] `(quote ~s)) You should consider downloading on lisp by Paul Graham from this page : http://www.paulgraham.com/onlisptext.html You'll learn everything you want to know about macros (it's in Common Lisp, but I think it is understable with just a clojure background,

Re: CLJOS - Spinoza, 3X faster than struct-map ;)

2009-02-06 Thread mikel
On Feb 6, 7:27 am, David Nolen dnolen.li...@gmail.com wrote: Yuck. Instead of defining a method on ::idea, you now must define a method on [something-that-has-no-meaning-in-context  ::idea] (because the dispatch function must now return a vector, which means the defmethods must now be

Re: Sudoku solver with GUI

2009-02-06 Thread Laurent PETIT
Hello, not related to your question, but you should consider renaming your file sudoku_solver to make it compiler friendly. Concerning your question, I think there have been some answers recently on the ml. Sorry I don't remember the links exactly. Regards, -- Laurent 2009/2/6 Tzach

Re: Strapped to the JVM?

2009-02-06 Thread e
I am. but that was also an attempt to (possibly) answer a question with a question. On Fri, Feb 6, 2009 at 7:28 PM, Raoul Duke rao...@gmail.com wrote: hi, On Fri, Feb 6, 2009 at 4:24 PM, e evier...@gmail.com wrote: What;s Ralph all about? You've certainly peaked my interest. google it

Re: Clojure Maps and Java Maps

2009-02-06 Thread Stuart Sierra
On Feb 6, 2:02 pm, Peter Wolf opus...@gmail.com wrote: How does one convert a Clojure Map to the equivalent Java Map?  I bet I could do it in one line if I knew the magic. To convert all keys to strings, there's clojure.contrib.walk/stringify- keys. -Stuart Sierra

Re: Newbie: Trying to defer evaluation of unbound variable arguments until needed with macros

2009-02-06 Thread samppi
Perfect. This is exactly what I need. Thank you. :) I wonder, is it customary to append an * to the names of functions that do the grunt work of corresponding macros? On Feb 6, 10:03 am, Christophe Grand christo...@cgrand.net wrote: samppi a écrit : Thanks for the reply. I've tried delays,

Re: Strapped to the JVM?

2009-02-06 Thread Rayne
We'd just have to write our own JVM of course. ;) On Feb 6, 6:19 pm, mikel mev...@mac.com wrote: What happens to Clojure if something bad happens to the JVM? It's not that I think the JVM is going away any time soon. Sure, Sun looks kind of shaky right now, but there are alternative sources

Re: Multimethod Reflection Question

2009-02-06 Thread David Nolen
Hmm, for example, this does not work: ([:spinoza/object :spinoza-example-three/serializable] (methods archive)) I get the following exception: java.lang.IllegalArgumentException: Key must be integer even though: (= [:spinoza/object :spinoza-example-three/serializable] (ffirst (methods

String/valueOf on char array

2009-02-06 Thread Kevin Albrecht
Why is this happening? (def cs (make-array Character/TYPE 1024)) (apply str cs) - (String/valueOf cs) - [...@42880d Shouldn't these return the same value? --Kevin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: Multimethod Reflection Question

2009-02-06 Thread David Nolen
Oops not paying attention you are right. Hash map comes first as the function. Works like a charm. 2009/2/6 Craig Andera craig.and...@gmail.com (methods multifn) Returns a hash-map where the keys are vectors if the dispatch values of the multimethods were vectors, weird and cool :)

Re: unchecked methods for floats/doubles?

2009-02-06 Thread Mark H.
On Feb 6, 7:14 pm, Korny Sietsma ko...@sietsma.com wrote: Hi folks - I was trying the example posted below, and I discovered a slight snag - unchecked-* methods don't exist for doubles or floats! (and if you call (unchecked-multiply 1.2 3.4) you get No matching method found... which caused