Re: outlining for clojure files in emacs+slime?

2010-12-05 Thread Eric Schulte
Hi Sunil, This is not quite what your asking for, but Org-mode [1] (an Emacs outlining mode) has support for embedded code blocks which can be executed, tangled etc... [2] in a number of languages including Clojure. Also, I often see ^L characters in lisp files inside of Emacs, I believe these

Re: Fixing minmax algorithm

2010-12-05 Thread Timo Myyrä
Thank you, this solved the issues I was having as far as I can tell. Now I can focus on getting rest of my chess engine working properly. Timo Jason Wolfe jawo...@berkeley.edu writes: You're looking for apply. user2 (max 1 2 3) 3 user2 (max [1 2 3]) [1 2 3] user2 (apply max [1 2 3]) 3

Message to Rich Hickey: Post Hammock-driven development slides

2010-12-05 Thread Ralph
Rich- Could you post the slides from your Hammock-driven development talk? Most excellent! Awesome in fact :-). 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

parameters destructuring sets?

2010-12-05 Thread Alex Ott
Hello all I have following question to Rich and other core developers of Clojure - why parameters destructuring requires presence of 'nth' implementation for destructuring of sequences? The [[x more]] idiom is very popular and could make code more concise, but it doesn't work for sets and some

Re: parameters destructuring sets?

2010-12-05 Thread Alex Ott
Re jweiss at Sun, 5 Dec 2010 10:29:41 -0800 (PST) wrote: j I'm no expert on this, but i'll take a crack at it. j I think it's because sets don't (necessarily) impose any order, so j there's no concept of first or nth. So destructuring would j essentially be assigning a random item to x, or

Re: parameters destructuring sets?

2010-12-05 Thread jweiss
On Dec 5, 2:10 pm, Alex Ott alex...@gmail.com wrote: Re jweiss  at Sun, 5 Dec 2010 10:29:41 -0800 (PST) wrote:  j I'm no expert on this, but i'll take a crack at it.  j I think it's because sets don't (necessarily) impose any order, so  j there's no concept of first or nth.  So

Re: Pre-expansion macro form

2010-12-05 Thread Alex Osborne
Brian Marick mar...@exampler.com writes: Is there any way to get the original call form? Something like env? Some hook into the reader? Try form -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: outlining for clojure files in emacs+slime?

2010-12-05 Thread Alan D. Salewski
On Sun, Dec 05, 2010 at 07:35:35AM -0700, Eric Schulte spake thus: Also, I often see ^L characters in lisp files inside of Emacs, I believe these characters are used for in-file navigation, but I don't know how, so that might be another avenue of investigation (I'd be interested to hear what

Why I'm getting StackoverflowError?

2010-12-05 Thread HB
Hi, I'm trying to write a function that calculates the length of a list: (defn list-length [col] (if col (+ 1 (list-length(rest col))) 0)) (list-length '(Java, Clojure, Scala)) Upon running it in the REPL, I got the error: java.lang.StackOverflowError (test.clj:3) What is going

Re: Pre-expansion macro form

2010-12-05 Thread Brian Marick
On Dec 5, 2010, at 3:32 PM, Alex Osborne wrote: Is there any way to get the original call form? Something like env? Some hook into the reader? Try form I should have guessed. Thanks. - Brian Marick, Artisanal Labrador Contract programming in Ruby and Clojure Author of /Ring/

Re: Why I'm getting StackoverflowError?

2010-12-05 Thread Danny Woods
On Dec 5, 9:52 pm, HB hubaghd...@gmail.com wrote: Hi, I'm trying to write a function that calculates the length of a list: (defn list-length [col]   (if col     (+ 1 (list-length(rest col)))     0)) (list-length '(Java, Clojure, Scala)) Upon running it in the REPL, I got the error:

Re: Why I'm getting StackoverflowError?

2010-12-05 Thread Robert McIntyre
Your function never actually ends because even the empty list evaluates to true :) rlm.dna-melting (if (rest '()) true false) true rlm.dna-melting (if (next '()) true false) false so, changing your list length function to use next will work rlm.dna-melting (defn list-length [col] (if col (+ 1

Re: Why I'm getting StackoverflowError?

2010-12-05 Thread Ken Wesson
On Sun, Dec 5, 2010 at 5:16 PM, Robert McIntyre r...@mit.edu wrote: Your function never actually ends  because even the empty list evaluates to true :) rlm.dna-melting (if (rest '()) true false) true rlm.dna-melting (if (next '()) true false) false so, changing your list length function

There is no such thing as IAtom

2010-12-05 Thread Pepijn de Vos
tl;dr: Please add an interface to clojure.lang.Atom. kthxbye I had the brilliant idea of using CouchDB for something equally brilliant, and if possible implement a Clojure view server. Turns out Clutch fits the bill perfectly, except that I would like to use Aleph, and Couch is using something

Re: parameters destructuring sets?

2010-12-05 Thread Ken Wesson
On Sun, Dec 5, 2010 at 1:29 PM, jweiss jeffrey.m.we...@gmail.com wrote: I'm no expert on this, but i'll take a crack at it. I think it's because sets don't (necessarily) impose any order, so there's no concept of first or nth.  So destructuring would essentially be assigning a random item to

Re: Why I'm getting StackoverflowError?

2010-12-05 Thread HB
What is the difference between rest and next? I'm confused, should I use empty? or not? when to use it? Robert, Your code is working but if I use empty? , it returns 0 instead of the actual count. Why? Why Clojure decided to handle an empty list as a not false? this is a big (if not) departure

Re: parameters destructuring sets?

2010-12-05 Thread Ken Wesson
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 undefined.  It's undefined on purpose. Now, if you are using a sorted-set, then you have a point there, I would expect that nth means something then.  But yeah, clojure

Re: Fixing minmax algorithm

2010-12-05 Thread Ken Wesson
On Sun, Dec 5, 2010 at 7:46 AM, Timo Myyrä timo.my...@gmail.com wrote: Thank you, this solved the issues I was having as far as I can tell. Now I can focus on getting rest of my chess engine working properly. Chess? Then you've got a problem. I didn't see any pruning or even depth bounding in

Re: Why I'm getting StackoverflowError?

2010-12-05 Thread Alex Osborne
HB hubaghd...@gmail.com writes: I'm trying to write a function that calculates the length of a list: (defn list-length [col] (if col (+ 1 (list-length(rest col))) 0)) (list-length '(Java, Clojure, Scala)) Upon running it in the REPL, I got the error:

Re: Broken MacPorts setup on OS X 10.5?

2010-12-05 Thread Phil Hagelberg
On Sun, Dec 5, 2010 at 10:05 AM, Philip Hudson phil.hud...@iname.com wrote: Anyone willing able to help troubleshoot a Mac 10.5 MacPorts setup? I've heard other bug reports with the MacPorts packaging of Leiningen. I'd recommend installing as per the Leiningen readme or using Homebrew until the

Re: Why I'm getting StackoverflowError?

2010-12-05 Thread Nadeem Vawda
In Clojure, empty sequences are not considered logically false, so your code continues going after reducing col to an empty list. You need to explicitly check whether the collection is empty, like so: (defn list-length [col] (if (empty? col) 0 (+ 1 (list-length (rest col) Cheers,

Re: Why I'm getting StackoverflowError?

2010-12-05 Thread HB
OMG, this is too much Clojure code for me to handle O.o Alex, you just killed me :) Do you previous Lisp knowledge? or Clojure is your first Lisp? you are so good. I will spend the next couple of hours studying it. Thanks all, you are awesome. On Dec 6, 12:47 am, Alex Osborne a...@meshy.org

math utilities question

2010-12-05 Thread Robert McIntyre
I'm trying to use clojure for scientific data analysis but I keep running into lacunas of functionality. I'd love to hear the community's recommendations and experiences with this: Is there a standard way to do things like: 1. take the convolution of two vectors 2. work with imaginary numbers,

Re: Why I'm getting StackoverflowError?

2010-12-05 Thread HB
Ken Alex, Why you aren't calling empty? when you want to check if a collection is empty? Isn't (if s) supposed to return true if s is empty ? On Dec 6, 12:27 am, Ken Wesson kwess...@gmail.com wrote: On Sun, Dec 5, 2010 at 5:16 PM, Robert McIntyre r...@mit.edu wrote: Your function never

Re: parameters destructuring sets?

2010-12-05 Thread Sunil S Nandihalli
+1 to what Ken said Sunil On Mon, Dec 6, 2010 at 4:04 AM, Ken Wesson kwess...@gmail.com wrote: 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 undefined. It's undefined on purpose. Now, if you are using a

Re: parameters destructuring sets?

2010-12-05 Thread Robert McIntyre
If sets don't have a set ordering, then why should seq on a set always return the same order for the same set? If seq doesn't always return the a seq with the same order, then (nth set 5) might be different than a future call to (nth set 5), because the underlying sequence returned by the set

Get sequence of values in arbitrarily nested collection

2010-12-05 Thread Alex Baranosky
Hi guys, I would like a function to be able to take an arbitrarily nested collection and return a sequence of all values of a given key, such as :name, that appears anywhere in the nested collection. Does anything like this already exist? Thanks for the help, Alex -- You received this message

Re: math utilities question

2010-12-05 Thread Ken Wesson
On Sun, Dec 5, 2010 at 6:27 PM, Robert McIntyre r...@mit.edu wrote: I'm trying to use clojure for scientific data analysis but I keep running into lacunas of functionality. I'd love to hear the community's recommendations and experiences with this: Is there a standard way to do things like:

Re: parameters destructuring sets?

2010-12-05 Thread Ken Wesson
On Sun, Dec 5, 2010 at 8:26 PM, Robert McIntyre r...@mit.edu wrote: If sets don't have a set ordering, then why should seq on a set always return the same order for the same set? If seq doesn't always return the a seq with the same order, then (nth set 5) might be different than a future call

Re: Get sequence of values in arbitrarily nested collection

2010-12-05 Thread Alex Baranosky
Here's my first attempt: (defn all-vals [key coll] (let [all-vals-w-key (partial all-vals key)] (cond (map? coll) (concat [(key coll)] (all-vals-w-key (vals coll))) (or (vector? coll) (seq? coll)) (apply concat (map all-vals-w-key coll) Call it like so: (fact

Re: Get sequence of values in arbitrarily nested collection

2010-12-05 Thread Alex Baranosky
The above is using Midje syntax: https://github.com/marick/Midje -- 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

Re: Get sequence of values in arbitrarily nested collection

2010-12-05 Thread Ken Wesson
On Sun, Dec 5, 2010 at 9:12 PM, Alex Baranosky alexander.barano...@gmail.com wrote: Hi guys, I would like a function to be able to take an arbitrarily nested collection and return a sequence of all values of a given key, such as :name, that appears anywhere in the nested collection. Does

Re: Why I'm getting StackoverflowError?

2010-12-05 Thread Ken Wesson
On Sun, Dec 5, 2010 at 6:55 PM, HB hubaghd...@gmail.com wrote: Ken Alex, Why you aren't calling empty? when you want to check if a collection is empty? Isn't (if s) supposed to return true if s is empty ? If coll is empty, (seq coll) and (next coll) are both nil, which is logical false. --

Re: Get sequence of values in arbitrarily nested collection

2010-12-05 Thread Ken Wesson
On Sun, Dec 5, 2010 at 10:03 PM, Ken Wesson kwess...@gmail.com wrote: On Sun, Dec 5, 2010 at 9:12 PM, Alex Baranosky alexander.barano...@gmail.com wrote: Hi guys, I would like a function to be able to take an arbitrarily nested collection and return a sequence of all values of a given key,

Re: Why I'm getting StackoverflowError?

2010-12-05 Thread Alex Osborne
HB hubaghd...@gmail.com writes: OMG, this is too much Clojure code for me to handle O.o Alex, you just killed me :) Hehe, sorry. Just thought it might be helpful to show the progression of dealing with all the little edge cases. It perhaps looks much more fiddly, but you're doing more there

Re: Why I'm getting StackoverflowError?

2010-12-05 Thread Alex Osborne
HB hubaghd...@gmail.com writes: Ken Alex, Why you aren't calling empty? when you want to check if a collection is empty? Here's the definition of empty? from clojure/core.clj: (defn empty? Returns true if coll has no items - same as (not (seq coll)). Please use the idiom

Re: math utilities question

2010-12-05 Thread Robert McIntyre
Thanks for your input --- I'm hoping that some of this stuff is already written with performance optimizations and the like. 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

Re: math utilities question

2010-12-05 Thread Miki
Have you looked at Incanter? (http://incanter.org/) On Dec 5, 3:27 pm, Robert McIntyre r...@mit.edu wrote: I'm trying to use clojure for scientific data analysis but I keep running into lacunas of functionality. I'd love to hear the community's recommendations and experiences with this: Is

Re: math utilities question

2010-12-05 Thread Ken Wesson
On Mon, Dec 6, 2010 at 12:14 AM, Miki miki.teb...@gmail.com wrote: Have you looked at Incanter? (http://incanter.org/) Hmm, interesting. Is there a Rhetor too? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: help with macro writing style

2010-12-05 Thread Sunil S Nandihalli
Really sorry about pasting the code in the email. It seems to have added 2-3 extra new-lines after every line .. :( .. but the same code is present in the github-gist. Sunil. On Mon, Dec 6, 2010 at 10:57 AM, Sunil S Nandihalli sunil.nandiha...@gmail.com wrote: Hello everybody, The following

Re: appengine-clj and appengine 1.4 SDK error

2010-12-05 Thread Miki
Seems like the problem was with lein 1.4, see https://github.com/technomancy/leiningen/issues#issue/142 On Dec 4, 8:21 am, Miki miki.teb...@gmail.com wrote: Greetings, My toy application stopped working after an upgrade to appengine SDK 1.4, does anyone else have the same experience? Any

Re: Get sequence of values in arbitrarily nested collection

2010-12-05 Thread Benny Tsai
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 all-vals [k coll] (let [vals (atom []) find-val (fn [form]

Re: math utilities question

2010-12-05 Thread Benny Tsai
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? (http://incanter.org/) Hmm, interesting. Is there a Rhetor too? -- You received this