Re: Get sequence of values in arbitrarily nested collection

2010-12-06 Thread Ken Wesson
On Mon, Dec 6, 2010 at 2:57 AM, Benny Tsai benny.t...@gmail.com wrote: When I saw the part about traversing an arbitrarily nested collection, I immediately thought of clojure.walk (http://clojure.github.com/ clojure/clojure.walk-api.html).  I ended up with this: (use 'clojure.walk) (defn

Re: math utilities question

2010-12-06 Thread Ken Wesson
On Mon, Dec 6, 2010 at 2:59 AM, Benny Tsai benny.t...@gmail.com wrote: Always nice to see a fellow Neal Stephenson fan! On Dec 5, 10:26 pm, Ken Wesson kwess...@gmail.com wrote: On Mon, Dec 6, 2010 at 12:14 AM, Miki miki.teb...@gmail.com wrote: Have you looked at Incanter?

Re: Why I'm getting StackoverflowError?

2010-12-06 Thread nickik
What is the difference between rest and next? This has to do with lazyness. I wrote an answer to that on stackoverflow. http://stackoverflow.com/questions/4288476/clojure-rest-vs-next Should answer everthing. I'm confused, should I use empty? or not? when to use it? Why Clojure decided to

Re: Why I'm getting StackoverflowError?

2010-12-06 Thread Ken Wesson
On Mon, Dec 6, 2010 at 4:02 AM, nickik nick...@gmail.com wrote: The easy (and good) solution is to pass the running result onlong the way. This can be done in diffrent ways. First the CL Style where you creat a new function in you function that then does all the work. (from Ken Wesson)

Re: math utilities question

2010-12-06 Thread Robert McIntyre
I have looked at incanter and like it very much, but these are all things that incanter can't currently do. --Robert McIntyre On Mon, Dec 6, 2010 at 3:15 AM, Saul Hazledine shaz...@gmail.com wrote: On Dec 6, 12:27 am, Robert McIntyre r...@mit.edu wrote: I'm trying to use clojure for scientific

Re: Why I'm getting StackoverflowError?

2010-12-06 Thread HB
I didn't expect my question would initiate such a wonderful discussion, I'm speechless. Thank you all guys, you are amazing. Alex, your posts killed in a very good way :) It was really helpful to morph the code and transform it. On Dec 6, 11:14 am, Ken Wesson kwess...@gmail.com wrote: On Mon,

Re: Fixing minmax algorithm

2010-12-06 Thread zmyrgel
Then you didn't look close enough of my first message :) Granted, I omitted large parts of the code in it but it showed my evaluate function with pruning attached. Here's my evaluate function, with debugging code cleaned: (defn- evaluate-with-minmax Evaluates given game state with

Re: Why I'm getting StackoverflowError?

2010-12-06 Thread Meikel Brandmeyer
Hi, Am 06.12.2010 um 10:14 schrieb Ken Wesson: Then we could use arity functions. (Alex Osborne) (defn list-length ([coll] (list-length coll 0)) ([coll n] (if-let [s (seq coll)] (recur (rest s) (inc n)) n))) This is nice style in

Re: Why I'm getting StackoverflowError?

2010-12-06 Thread Ken Wesson
On Mon, Dec 6, 2010 at 5:19 AM, Meikel Brandmeyer m...@kotka.de wrote: Hi, Am 06.12.2010 um 10:14 schrieb Ken Wesson: Then we could use arity functions. (Alex Osborne)    (defn list-length      ([coll]   (list-length coll 0))      ([coll n] (if-let [s (seq coll)]                    

Re: Why I'm getting StackoverflowError?

2010-12-06 Thread nickik
On Dec 6, 11:40 am, Ken Wesson kwess...@gmail.com wrote: Won't that make the internal recursive call fail though? And even if not -- ugly IMO. :) Agree. Why make something slower and more ugly? -- You received this message because you are subscribed to the Google Groups Clojure group. To

Re: parameters destructuring sets?

2010-12-06 Thread Stuart Halloway
Archive search nth seq hickey: http://groups.google.com/group/clojure/browse_thread/thread/ffa3f56c3bb32bc3/773b23a34e88acab?lnk=gstq=nth+seq+hickey#773b23a34e88acab Stu On Sun, Dec 5, 2010 at 4:14 PM, jweiss jeffrey.m.we...@gmail.com wrote: That's totally different than nth for a set being

Re: parameters destructuring sets?

2010-12-06 Thread Ken Wesson
On Mon, Dec 6, 2010 at 8:24 AM, Stuart Halloway stuart.hallo...@gmail.com wrote: Archive search nth seq hickey: http://groups.google.com/group/clojure/browse_thread/thread/ffa3f56c3bb32bc3/773b23a34e88acab?lnk=gstq=nth+seq+hickey#773b23a34e88acab Interesting. But that was years ago, Hickey no

Re: math utilities question

2010-12-06 Thread Johann Hibschman
Robert McIntyre r...@mit.edu writes: I'm wondering if people have had experience with java libraries of that sort and might have some recommendations. Anyone use clojure for scientific data analysis? What do you find helpful to use? I'm still just evaluating clojure for scientific data

Re: Get sequence of values in arbitrarily nested collection

2010-12-06 Thread Justin Kramer
tree-seq makes this pretty simple: (defn nested-vals [key coll] (for [x (tree-seq coll? seq coll) :when (contains? x key)] (get x key))) This works with any type of key and all associative Clojure structures. It could be made compatible with Java structures by swapping out the 'coll?'

Re: Apache ws-xmlrpc

2010-12-06 Thread Rayne
Clojure's Java interop is extremely impressive and straightforward -- to someone who is somewhat familiar with Java. I don't know Java, but I've learned to work with it pretty well just by using Clojure. When I started out, it was extremely difficult, because I couldn't read javadocs and didn't

Re: Get sequence of values in arbitrarily nested collection

2010-12-06 Thread Alyssa Kwan
+1 Lazy is better. Personally, I would have used filter and map instead of for, but this is probably clearer. Thanks, Alyssa On Dec 6, 10:30 am, Justin Kramer jkkra...@gmail.com wrote: tree-seq makes this pretty simple: (defn nested-vals [key coll]   (for [x (tree-seq coll? seq coll) :when

Re: Get sequence of values in arbitrarily nested collection

2010-12-06 Thread Benny Tsai
Nice! I knew there had to be a nicer way of traversing nested collections :) Thank you for this. On Dec 6, 8:30 am, Justin Kramer jkkra...@gmail.com wrote: tree-seq makes this pretty simple: (defn nested-vals [key coll]   (for [x (tree-seq coll? seq coll) :when (contains? x key)]     (get

Re: Why I'm getting StackoverflowError?

2010-12-06 Thread Meikel Brandmeyer
Hi, Am 06.12.2010 um 11:40 schrieb Ken Wesson: Won't that make the internal recursive call fail though? No. Because the metadata is just documentation. And even if not -- ugly IMO. :) Tastes vary. I prefer this over a second toplevel function named foo-aux or the like. I also prefer it

Re: math utilities question

2010-12-06 Thread Konrad Hinsen
On 06.12.2010, at 16:02, Johann Hibschman wrote: (Konrad Hinsen had started some work on multiarrays in Clojure, but I've not been following his progress.) There hasn't been much, unfortunately. I haven't found much time for serious Clojure hacking for a few months. But the project is not

Re: There is no such thing as IAtom

2010-12-06 Thread pepijn (aka fliebel)
You can not extend them, as they are marked final. Another point to consider is clojure-in-clojure. If that is ever going to happen, one needs to be able to implement Atom as well. It is also generally better to code to an interface rather than to an implementation. Alter and send also work

Re: parameters destructuring sets?

2010-12-06 Thread Stuart Sierra
On Dec 6, 8:36 am, Ken Wesson kwess...@gmail.com wrote: Furthermore, the comment (not made by Hickey) that map order may be unstable is more than a little puzzling in light of the fact that the maps in question are immutable. :) In general, Rich has been careful not to promise things that

Re: There is no such thing as IAtom

2010-12-06 Thread Alyssa Kwan
+1 There is no STM integration with atoms. That's not a concern. Just write your own Clojure core with your change. I did for durable identities. shamelessPluggit://github.com/kwanalyssa/clojure.git/ shamelessPlug Seriously though, just use protocols. Thanks, Alyssa On Dec 6, 5:24 am,

Re: ANN: Durable Clojure - Functions and Closures

2010-12-06 Thread Alyssa Kwan
Yes, but why isn't persistence of emclosures/em generating more interest. ;) Persistence is solved, if you're OK with not being truly ACID... Seriously though, everyone has their own backends. I don't think anyone wants to be tied to BDB JE. Would there be interest in lazy-loading and

Re: ANN: Durable Clojure - Functions and Closures

2010-12-06 Thread Ken Wesson
On Mon, Dec 6, 2010 at 1:09 PM, Alyssa Kwan alyssa.c.k...@gmail.com wrote: Yes, but why isn't persistence of emclosures/em generating more interest.  ;) Persistence is solved, if you're OK with not being truly ACID... Seriously though, everyone has their own backends.  I don't think anyone

Re: parameters destructuring sets?

2010-12-06 Thread Ken Wesson
On Mon, Dec 6, 2010 at 1:05 PM, Stuart Sierra the.stuart.sie...@gmail.com wrote: On Dec 6, 8:36 am, Ken Wesson kwess...@gmail.com wrote: Furthermore, the comment (not made by Hickey) that map order may be unstable is more than a little puzzling in light of the fact that the maps in question

Re: math utilities question

2010-12-06 Thread Ken Wesson
On Mon, Dec 6, 2010 at 11:45 AM, Konrad Hinsen konrad.hin...@fastmail.net wrote: On 06.12.2010, at 16:02, Johann Hibschman wrote: Maybe I'm not reading the right news, but I've not seen all that much on using Java for scientific work for a while now.  The NIST JavaNumerics guys seem to have

Re: parameters destructuring sets?

2010-12-06 Thread Mike Meyer
On Mon, 6 Dec 2010 16:30:10 -0500 Ken Wesson kwess...@gmail.com wrote: On Mon, Dec 6, 2010 at 1:05 PM, Stuart Sierra the.stuart.sie...@gmail.com wrote: On Dec 6, 8:36 am, Ken Wesson kwess...@gmail.com wrote: Furthermore, the comment (not made by Hickey) that map order may be unstable is

Re: Apache ws-xmlrpc

2010-12-06 Thread Rock
Great! I'll give it a try for sure :) On Dec 6, 4:55 pm, Rayne disciplera...@gmail.com wrote: Clojure's Java interop is extremely impressive and straightforward -- to someone who is somewhat familiar with Java. I don't know Java, but I've learned to work with it pretty well just by using

Re: parameters destructuring sets?

2010-12-06 Thread Ken Wesson
On Mon, Dec 6, 2010 at 4:44 PM, Mike Meyer mwm-keyword-googlegroups.620...@mired.org wrote: On Mon, 6 Dec 2010 16:30:10 -0500 Ken Wesson kwess...@gmail.com wrote: On Mon, Dec 6, 2010 at 1:05 PM, Stuart Sierra the.stuart.sie...@gmail.com wrote: On Dec 6, 8:36 am, Ken Wesson

Swank-clojure: unreadable message

2010-12-06 Thread Philip Hudson
Thanks for earlier help on (not) using MacPorts leiningen. Having installed leiningen as per site instructions, I also followed site instructions for installing swank-clojure using leiningen. These instructions reference a SNAPSHOT build of swank-clojure. After install, `lein

Re: parameters destructuring sets?

2010-12-06 Thread Mike Meyer
On Mon, 6 Dec 2010 17:07:15 -0500 Ken Wesson kwess...@gmail.com wrote: On Mon, Dec 6, 2010 at 4:44 PM, Mike Meyer mwm-keyword-googlegroups.620...@mired.org wrote: On Mon, 6 Dec 2010 16:30:10 -0500 Ken Wesson kwess...@gmail.com wrote: On Mon, Dec 6, 2010 at 1:05 PM, Stuart Sierra

Re: parameters destructuring sets?

2010-12-06 Thread Michael Gardner
On Dec 6, 2010, at 4:07 PM, Ken Wesson wrote: Perhaps. But under those circumstances seq itself has the same problem you're using to excuse not supporting nth, yet seq is supported. And so is (nth (seq x)) on these things; if the implementation changed its innards while you were walking the

Re: parameters destructuring sets?

2010-12-06 Thread Ken Wesson
On Mon, Dec 6, 2010 at 5:43 PM, Michael Gardner gardne...@gmail.com wrote: On Dec 6, 2010, at 4:07 PM, Ken Wesson wrote: Perhaps. But under those circumstances seq itself has the same problem you're using to excuse not supporting nth, yet seq is supported. And so is (nth (seq x)) on these

Re: parameters destructuring sets?

2010-12-06 Thread Laurent PETIT
sorry to jump in this weird conversation, but it seems to me that you are on parallel discussion without acknowleding it. To me, the only thing which makes sense is that saying that seq promises no deterministic ordering on sets and maps is not about calling seq on the same java instance of a set

Re: parameters destructuring sets?

2010-12-06 Thread Michael Gardner
On Dec 6, 2010, at 5:35 PM, Ken Wesson wrote: Who was relying on the order? If you merely relied on seeing 5 or 6, or on not seeing 3 or 4 twice, you were screwed. Ah, I misunderstood what you wrote. Obviously (seq) should hand you each item in the collection exactly once, but that's at a

Lots of newbie clojure questions

2010-12-06 Thread javajosh
Hello, I'm a long-time Java programmer who's tired of mutability getting in my way. I've been largely enjoying the pervasive use of closures in JavaScript, and though I'd check out Clojure. So far so good. It installed easily and the REPL is easy to use. I've watched the screencasts and have

Re: Lots of newbie clojure questions

2010-12-06 Thread David Jacobs
1. Isn't the world actually imperative? And mutable? If you're a determinist, then no. Life is a function (albeit a multivariable function), just like sine. 2. 'Side-effects' are treated almost as a bad word by most functional programming advocates. And yet, aren't ALL programs executed

Re: Lots of newbie clojure questions

2010-12-06 Thread Stuart Halloway
1. Isn't the world actually imperative? And mutable? Collaboration *is* a messy proposition in real life. It's hard to fix your car, and even harder to have lots of people fix your car. I find the it models the real world better justification for functional programming rather confusing.

Re: ANN: Dr. Evil - the evil web debugger

2010-12-06 Thread Miki
I've played a bit with the code and now namespaces behave. There's even a set-ns! function to set the current namespace to what you want. On Nov 30, 9:07 am, Constantine Vetoshev gepar...@gmail.com wrote: On Nov 29, 2:25 pm, Miki miki.teb...@gmail.com wrote: Yeah, it uses load-string which

Re: Lots of newbie clojure questions

2010-12-06 Thread Mike Meyer
On Mon, 6 Dec 2010 16:50:40 -0800 (PST) javajosh javaj...@gmail.com wrote: 1. What is the justification for using a map as a function? I find this to be very confusing. The same as using a keyword for a function - it lets you write shorter code. 2. In practice, I find myself wincing when

Re: resultset-seq improvement: mapping column names

2010-12-06 Thread Allen Johnson
+1 On Fri, Dec 3, 2010 at 10:25 PM, ka sancha...@gmail.com wrote: I'm also stuck with the same issues: 1. no option to get string keys 2. I don't understand, why do libs go through the trouble of downcasing ? Having said that I totally agree with the point Ryan makes: A greater feature of

Re: Lots of newbie clojure questions

2010-12-06 Thread javajosh
On Dec 6, 5:40 pm, Stuart Halloway stuart.hallo...@gmail.com wrote: The world is a series of immutable states, and the future is a function of the past. See http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey. My philosophy questions are the most interesting to people, ha! Neat

Re: ANN: Dr. Evil - the evil web debugger

2010-12-06 Thread Vilson Vieira
Hello Miki, I'm writing a simple Clojure editor based on jSyntaxPane. I'm trying to intern a function (it's defined on live-processing.editor, and I want to redefine it with (eval (read-string ...))). Any help? Thanks. 2010/12/6 Miki miki.teb...@gmail.com: I've played a bit with the code and

Re: Lots of newbie clojure questions

2010-12-06 Thread Robert McIntyre
1. What is the justification for using a map as a function? I find this to be very confusing. In math, a function is a mapping from one set to another, so from that perspective it makes good sense for a clojure-map to be a function from its set of keys to its set of values. The justification here

Re: ANN: Dr. Evil - the evil web debugger

2010-12-06 Thread James Reeves
On 21 November 2010 22:57, Miki miki.teb...@gmail.com wrote: Usage is simple - add EVIL definition to your application defroutes:  (defroutes app    (GET / [] Nothing here! (try /evil))    (EVIL /evil)    (route/not-found Dude! I can't find it.)) Comments/criticism/improvements welcomed.

Re: Lots of newbie clojure questions

2010-12-06 Thread Robert McIntyre
@javajosh You're speaking of the Turing description of computation, you might be interested in Church's lambda calculus description which works just as well and doesn't use mutability to describe computation, --Robert McIntyre On Mon, Dec 6, 2010 at 9:08 PM, javajosh javaj...@gmail.com wrote:

Re: ANN: Dr. Evil - the evil web debugger

2010-12-06 Thread Vilson Vieira
It's working! I'm using load-string instead of read-string. Sorry about the noise. 2010/12/7 Vilson Vieira vil...@void.cc: Hello Miki, I'm writing a simple Clojure editor based on jSyntaxPane. I'm trying to intern a function (it's defined on live-processing.editor, and I want to redefine it

Re: parameters destructuring sets?

2010-12-06 Thread Ken Wesson
On Mon, Dec 6, 2010 at 7:10 PM, Michael Gardner gardne...@gmail.com wrote: On Dec 6, 2010, at 5:35 PM, Ken Wesson wrote: Who was relying on the order? If you merely relied on seeing 5 or 6, or on not seeing 3 or 4 twice, you were screwed. Ah, I misunderstood what you wrote. Obviously (seq)

Bug in clojure.contrib.core/-? (improper quoting?)

2010-12-06 Thread Jason Wolfe
This happens in both Clojure 1.2 and 1.3-latest: user= (require 'clojure.contrib.core) nil user= (clojure.contrib.core/-? 1 inc) 2 user= (clojure.contrib.core/-? 1 inc inc) CompilerException java.lang.Exception: Unable to resolve symbol: -? in this context, compiling:(NO_SOURCE_PATH:3) I assume

Re: parameters destructuring sets?

2010-12-06 Thread Michael Gardner
On Dec 6, 2010, at 9:02 PM, Ken Wesson wrote: I'll try this one more time. You suggested the innards, and with them the seq order of the elements, might get rearranged. I suggested no such thing; perhaps you are confusing me with Mike Meyer? I referred more generally to the possibility of two

mapmap?

2010-12-06 Thread Alex Baranosky
Do the standard libraries contain a function to map a function over a map? (mapmap inc {:a 1 :b 2}) = (2, 3) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members

Re: mapmap?

2010-12-06 Thread Alex Baranosky
Oops. I meant: (mapmap inc {:a 1 :b 2}) = { :a 2 :b 3) Sorry about that. Alex -- 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

Re: mapmap?

2010-12-06 Thread Sunil S Nandihalli
Hi Alex, (clojure.contrib.generic.functor/fmap inc {:a 1 :b 2}) = {:a 2 :b 3} The above is probably what you want. HTH Sunil. On Tue, Dec 7, 2010 at 9:26 AM, Alex Baranosky alexander.barano...@gmail.com wrote: Oops. I meant: (mapmap inc {:a 1 :b 2}) = { :a 2 :b 3) Sorry about that.

Re: mapmap?

2010-12-06 Thread Alex Baranosky
Thanks Sunil. On Mon, Dec 6, 2010 at 11:00 PM, Sunil S Nandihalli sunil.nandiha...@gmail.com wrote: Hi Alex, (clojure.contrib.generic.functor/fmap inc {:a 1 :b 2}) = {:a 2 :b 3} The above is probably what you want. HTH Sunil. On Tue, Dec 7, 2010 at 9:26 AM, Alex Baranosky

Re: Bug in clojure.contrib.core/-? (improper quoting?)

2010-12-06 Thread Ken Wesson
On Mon, Dec 6, 2010 at 10:27 PM, Jason Wolfe jawo...@berkeley.edu wrote: This happens in both Clojure 1.2 and 1.3-latest: user= (require 'clojure.contrib.core) nil user= (clojure.contrib.core/-? 1 inc) 2 user= (clojure.contrib.core/-? 1 inc inc) CompilerException java.lang.Exception:

Re: mapmap?

2010-12-06 Thread Ken Wesson
This is also very easy to implement: (into {} (for [[k v] the-map] [k (f v)])) e.g. user= (into {} (for [[k v] {:a 3 :b 7}] [k (inc v)])) {:a 4, :b 8} user= and to encapsulate as a function: (defn fmap [f m] (into {} (for [[k v] m] [k (f v)]))) -- You received this

Re: parameters destructuring sets?

2010-12-06 Thread Ken Wesson
On Mon, Dec 6, 2010 at 10:45 PM, Michael Gardner gardne...@gmail.com wrote: On Dec 6, 2010, at 9:02 PM, Ken Wesson wrote: I'll try this one more time. You suggested the innards, and with them the seq order of the elements, might get rearranged. I suggested no such thing; perhaps you are

Moderately off-topic: installing emacs on OSX

2010-12-06 Thread javajosh
Sorry for asking here, but I think it's at least a little relevant to Clojure since I for one wouldn't be installing emacs if it wasn't for Clojure and Slime. Getting prompts about what the function arguments are seems like a HUGE benefit when learning this langauge. I imagine other non-emacs

easiest way to make a map out of a list?

2010-12-06 Thread Alex Baranosky
Way I have [:a 1:b 2] and I want to convert it to {:a 1 :b 2} What's the idiomatic way to do this in Clojure? Thanks for the help, Alex -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note

Re: mapmap?

2010-12-06 Thread Alex Baranosky
I think it will be fun to come up with a solution that will work with n maps: (defn multi-fmap [f maps] ...) i.e. (multi-fmap #(+ %1 %1 %2 ) {:a 1 :b 2} {:a 3 :b 4}) = {:a 5 :b 8} (multi-fmap #(+ %1 %2 %3 ) {:a 1 :b 2} {:a 3 :b 4} {:a 5 :b 6}) = {:a 9 :b 12} -- You received this message

Re: Swank-clojure: unreadable message

2010-12-06 Thread Phil Hagelberg
On Mon, Dec 6, 2010 at 2:13 PM, Philip Hudson phil.hud...@iname.com wrote: Now, in emacs, after doing `M-x slime-connect' and accepting the default prompt values, I get the fancy slime animation, but swank-clojure 1.3.0-SNAPSHOT immediately throws: unreadable message: (:emacs-rex

Re: easiest way to make a map out of a list?

2010-12-06 Thread Sunil S Nandihalli
On Tue, Dec 7, 2010 at 10:31 AM, Alex Baranosky alexander.barano...@gmail.com wrote: Way I have (apply hash-map [:a 1:b 2]) and I want to convert it to {:a 1 :b 2} What's the idiomatic way to do this in Clojure? Thanks for the help, Alex -- You received this message because

Re: easiest way to make a map out of a list?

2010-12-06 Thread Alex Baranosky
ah, I had tried hash-map without apply, but yours actually works. :) Thanks. On Tue, Dec 7, 2010 at 12:06 AM, Sunil S Nandihalli sunil.nandiha...@gmail.com wrote: On Tue, Dec 7, 2010 at 10:31 AM, Alex Baranosky alexander.barano...@gmail.com wrote: Way I have (apply hash-map [:a

Re: Moderately off-topic: installing emacs on OSX

2010-12-06 Thread Phil Hagelberg
On Mon, Dec 6, 2010 at 9:00 PM, javajosh javaj...@gmail.com wrote: Sorry for asking here, but I think it's at least a little relevant to Clojure since I for one wouldn't be installing emacs if it wasn't for Clojure and Slime. Getting prompts about what the function arguments are seems like a

How can I avoid needing this other function?

2010-12-06 Thread Alex Baranosky
Here is the code I'm working on. The first function is wanted. The second is not. (and the duplication is waiting to be factored out somehow...) Is there an idiomatic Clojure way to use map-of-distances on the Line of Note below, instead of map-of-distances* ? Thanks for all your help. (defn

Re: math utilities question

2010-12-06 Thread Konrad Hinsen
On 06.12.2010, at 22:35, Ken Wesson wrote: I'd say what Java needs is not complex numbers as a value type, but a way to define additional value types. Complex numbers are just one applications. Another one is points (2D or 3D) for geometry and graphics. Unfortunately the problem is not

Re: How can I avoid needing this other function?

2010-12-06 Thread Mike Meyer
On Tue, 7 Dec 2010 00:44:52 -0500 Alex Baranosky alexander.barano...@gmail.com wrote: Here is the code I'm working on. The first function is wanted. The second is not. (and the duplication is waiting to be factored out somehow...) Is there an idiomatic Clojure way to use map-of-distances on

Re: How can I avoid needing this other function?

2010-12-06 Thread Alexandre Patry
On 10-12-07 12:44 AM, Alex Baranosky wrote: Here is the code I'm working on. The first function is wanted. The second is not. (and the duplication is waiting to be factored out somehow...) Is there an idiomatic Clojure way to use map-of-distances on the Line of Note below, instead of

Re: mapmap?

2010-12-06 Thread Ken Wesson
On Tue, Dec 7, 2010 at 12:04 AM, Alex Baranosky alexander.barano...@gmail.com wrote: I think it will be fun to come up with a solution that will work with n maps: (defn multi-fmap [f maps]    ...) i.e. (multi-fmap #(+ %1 %1 %2 ) {:a 1 :b 2} {:a 3 :b 4}) = {:a 5 :b 8} (multi-fmap #(+ %1 %2

Re: math utilities question

2010-12-06 Thread Ken Wesson
On Tue, Dec 7, 2010 at 12:58 AM, Konrad Hinsen konrad.hin...@fastmail.net wrote: On 06.12.2010, at 22:35, Ken Wesson wrote: I'd say what Java needs is not complex numbers as a value type, but a way to define additional value types. Complex numbers are just one applications. Another one is

Re: How can I avoid needing this other function?

2010-12-06 Thread Alex Baranosky
Hello Alexandre, This code makes my tests pass: (defn distances [origin locations] (map #(dist-in-miles origin %) locations)) (defn map-of-distances [origin locations] (apply hash-map (interleave locations (apply distances origin locations Thanks for the inspiration! -- You

Re: How can I avoid needing this other function?

2010-12-06 Thread Alexandre Patry
On 10-12-07 01:37 AM, Alex Baranosky wrote: Hello Alexandre, This code makes my tests pass: (defn distances [origin locations] (map #(dist-in-miles origin %) locations)) (defn map-of-distances [origin locations] (apply hash-map (interleave locations (apply distances origin

[OT] ASF loses Java showdown vote to Oracle

2010-12-06 Thread Baishampayan Ghose
Hello, http://www.theregister.co.uk/2010/12/07/apache_google_vote_no_oracle_roadmap/ http://news.ycombinator.com/item?id=1977720 Does this mean anything for Clojure (on the JVM)? Regards, BG -- Baishampayan Ghose b.ghose at gmail.com -- You received this message because you are subscribed

Re: Moderately off-topic: installing emacs on OSX

2010-12-06 Thread javajosh
On Dec 6, 9:16 pm, Phil Hagelberg p...@hagelb.org wrote: On Mon, Dec 6, 2010 at 9:00 PM, javajosh javaj...@gmail.com wrote: Sorry for asking here, but I think it's at least a little relevant to Clojure since I for one wouldn't be installing emacs if it wasn't for Clojure and Slime.

Re: Lots of newbie clojure questions

2010-12-06 Thread javajosh
On Dec 6, 6:24 pm, Robert McIntyre r...@mit.edu wrote: @javajosh You're speaking of the Turing description of computation, you might be interested in Church's lambda calculus description which works just as well and doesn't use mutability to describe computation, Thanks, I'll look into that.

Re: Lots of newbie clojure questions

2010-12-06 Thread javajosh
On Dec 6, 6:01 pm, Mike Meyer mwm-keyword-googlegroups. 620...@mired.org wrote: good stuff snipped Mike and I have had a nice off-line conversation where we enumerated the possible things that can come after open-parens. I listed 7, he added 3: 1. A value (if the paren has a tick '( ) 2. A

Re: math utilities question

2010-12-06 Thread Ken Wesson
(defmacro defchunk [name tps] `(def ~name (quote ~tps))) (defmacro let-chunk [vname name val-vec body] (let [chunk-def @(resolve name) types (map first chunk-def) part-names (map (comp symbol (partial str vname !) second) chunk-def)] `(let [~vname ~val-vec

Re: math utilities question

2010-12-06 Thread Joonas Pulakka
Standard way, definitely no. As others have pointed out, Incanter is The Clojure Math Tool, but strongly biased towards statistics and linear algebra, and outside those fields you'll need other tools. Apache Commons Math (http://commons.apache.org/math/) is one of the better self-contained Java

Re: Lots of newbie clojure questions

2010-12-06 Thread Ken Wesson
On Tue, Dec 7, 2010 at 2:15 AM, javajosh javaj...@gmail.com wrote: Mike and I have had a nice off-line conversation where we enumerated the possible things that can come after open-parens. I listed 7, he added 3: 1. A value (if the paren has a tick '(  ) 2. A function. 3. A map - which is a