Bug: recur won't work in tail position within cond

2008-12-03 Thread puzzler
(defn sub-til-0 [n] (if (zero? n) 0 (recur (dec 1 works but the equivalent (defn sub-til-0 [n] (cond [(zero? n) 0] [:else (recur (dec 1))])) does not. Recursion is already limited enough in Clojure... give us recur in tail position within cond! :) Thanks, Mark --~--~-

Re: Bug: recur won't work in tail position within cond

2008-12-03 Thread puzzler
Whoops, I was thinking in Scheme. Thanks for pointing out my mistake, Mark --~--~-~--~~~---~--~~ 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 To unsubscr

Bug (I think): Can't sort collection of vectors containing big integers

2008-12-03 Thread puzzler
OK, after my last goof-up in reporting a bug, I'm reluctant to state with certainty that this is a bug, but it sure seems that way: This works: (sort [[5 2] [1 0] [3 4]]) This works: (sort [3243214324324132413243243243243243243234 324132]) This does not work: (sort [[343243214324324324132423432

Re: Running out of memory when using filter?

2008-12-06 Thread puzzler
OK, I see what you're saying now. Range doesn't cause problems because it's not coded in a way that links to a bunch of other cells. So it's plausible that the problem is the way filter hangs on to the collection while generating the rest (since it's not a tail-recursive call in that case). This

Re: sorted-set-by?

2009-02-07 Thread puzzler
Still, I think it's a good point that since Clojure has sorted-map-by, it seems logical to expect that it would also have sorted-set-by. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this

Re: ANN: ClojureScript 0.0-2496, cljs.test - a clojure.test port

2015-05-07 Thread puzzler
I can't find any documentation or examples for using the new cljs.test namespace. Can someone point me in the right direction? 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 Not

amb

2008-11-27 Thread puzzler
I've only seen continuation-based implementations of the amb operator. Is there an alternative way to code amb that would work in Clojure? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to t

Getting Started question

2008-11-29 Thread puzzler
On Windows, when I enter the following line from "Getting Started" into the REPL, nothing happens... it just hangs: (. javax.swing.JOptionPane (showMessageDialog nil "Hello World")) Any idea why this isn't working for me? Also, has anyone written a more detailed guide to getting up and running o

Re: Getting Started question

2008-11-29 Thread puzzler
Never mind. I found the other thread on this topic from a few months ago, and yes, it turned out the dialog was popping up behind the console window. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group.

Re: Getting Started question

2008-11-29 Thread puzzler
On Nov 29, 5:39 pm, Randall R Schulz <[EMAIL PROTECTED]> wrote: > On Saturday 29 November 2008 17:28, puzzler wrote: > SLIME is an Emacs-based development environment for programming Lisp > under Emacs (technically, "The Superior Lisp Interaction Mode for > Emacs").

Re: Getting Started question

2008-11-29 Thread puzzler
Sounds great, but the link to the installer given in that thread is broken :( . On Nov 29, 7:11 pm, Mark Feeney <[EMAIL PROTECTED]> wrote: > "Clojure Box, alpha" > thread:http://groups.google.com/group/clojure/browse_frm/thread/6fd17fb97f05... --~--~-~--~~~---~--~---

Re: Getting Started question

2008-11-29 Thread puzzler
Ok, I found the right link. I'll give it a try... --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send e

Converting collections of chars to a string?

2008-11-30 Thread puzzler
I would expect something like this to work: (String. (into-array [\a \b \c])) would yield "abc", but it gives me an error. It seems very natural to turn a string into a Clojure collection to do various manipulations, but then how do you turn a collection of characters back into a string? --~--~--

Vector concatenation

2008-11-30 Thread puzzler
subvec is O(1) because it takes advantage of sharing. This is quite useful. Is there a way to write concatvec in an O(1) way, taking advantage of sharing? I suspect that the "obvious way" to concatenate vectors, i.e., (into [] (concat v1 v2)), would be O(n). --~--~-~--~~~

Java libraries

2008-12-01 Thread puzzler
Clojure is designed for concurrency, but I don't see any functions in the API to spin off new threads. So I assume you're expected to know and use Java libraries for this. For those of us who are coming to Clojure without knowing a whole lot of Java, it would be useful if someone could provide p

Re: Lazy living, without variables

2008-12-01 Thread puzzler
I'm often copying "classic algorithms" from various sources, and it is true that it can take some thought to do a functional conversion. Sometimes, it's easier to just go ahead and use mutable local variables. Fortunately, Clojure lets you do mutability if needed. But I'm still unclear on the be