Re: FAQ

2008-12-19 Thread Mon Key
Some thoughts on really stupid things that have tripped me up: - How do I exit Clojure - srsly C-c - Whatsa JVM - does this mean Clojure is really just Java with parens? - Whatsa Classpath? this answer presents the *ALL* important opportunity to mention that *nix uses `:' to separate paths

Re: Preparing for Release 1.0 (was: Re: 20081217 Release)

2008-12-19 Thread Mon Key
I would propose, that the files are hosted where ever they are hosted now with suitable labels with which Clojure version they work. This works out of the box with the least amount of trouble. Meikel In contrast to the monolithic GG Code repo or C*AN or git/hg/bzr.*hubs I find that the

A more useful assert macro

2008-12-19 Thread jdz
At the moment assert macro accepts only a single argument - a test. If the test fails (is false), an exception is thrown. But the only information available (until we have better introspection tools) is the test _expression_. This causes problems when working on many items that should satisfy an

Re: Problems with gen-and-load-class (defn user-exception-test [] (try (throw (new user.UserException msg: user exception was here!!)) (catch user.UserException e (prn caught exception e)) (fi

2008-12-19 Thread Jesse Aldridge
It would be nice if someone updated the wiki with a new example. I don't understand how the gen-class stuff is supposed to work. Why doesn't the following work? (gen-class :name MyException :extends [Exception]) (defn user-exception-test [] (try (throw (new MyException msg: user

Re: Suggestion: introduce (defn name attr-map? [params*] doc-string body) form.

2008-12-19 Thread Michael Wood
On Fri, Dec 19, 2008 at 2:41 AM, Christian Vest Hansen karmazi...@gmail.com wrote: All. I think it would be nice if the doc-string was allowed (in addition to current behavior) to immediately follow the params vector in the various defsomethings. To the best of my knowledge, such a change

Re: test-is possible bug in are

2008-12-19 Thread Mark Volkmann
On Thu, Dec 18, 2008 at 9:08 PM, Stuart Sierra the.stuart.sie...@gmail.com wrote: On Dec 18, 6:05 pm, Mark Volkmann r.mark.volkm...@gmail.com wrote: If I understand correctly, (are ( 1 2, 5 7)) is equivalent to (is ( 1 2)) (is ( 5 7)) Not exactly. The first argument to are is a

Re: Suggestion: introduce (defn name attr-map? [params*] doc-string body) form.

2008-12-19 Thread Christian Vest Hansen
On Fri, Dec 19, 2008 at 12:46 PM, Michael Wood esiot...@gmail.com wrote: Where would it go when you have multiple parameter lists and bodies? (defn blah ([a] (do-something-with a)) ([a b] (do-something-with a b))) That case should be unchanged, and work as it does today. -- Michael Wood

Re: A try on condp

2008-12-19 Thread Mark Volkmann
On Thu, Dec 18, 2008 at 5:26 PM, Meikel Brandmeyer m...@kotka.de wrote: Hi, I reworked my initial proposal according to the comments of Rich. The syntax now looks as follows: (condp predicate expr test-expr result-expr test-expr : result-expr What is :? Is that just a keyword whose

Re: A try on condp

2008-12-19 Thread Meikel Brandmeyer
Hi Mark, On 19 Dez., 13:12, Mark Volkmann r.mark.volkm...@gmail.com wrote: What is :? Is that just a keyword whose name is ? It's exactly that: a keyword with the name . I think adding more characters with special meaning makes code harder to read, so I hope we don't add more of these.

syntax philosophy

2008-12-19 Thread Mark Volkmann
If you don't need this, you don't have to use it. I feel very strongly that Clojure, and any programming language, should avoid using this rationale when adding support for new syntax. Just because a developer chooses not to use a particular feature doesn't mean they don't have to understand

groups-of

2008-12-19 Thread hosia...@gmail.com
I'm learning Clojure by trying to implement some functions from Ruby core/stdlib/ActiveSupport's core_ext. The first one I wrote is groups-of (similar to ActiveSupport's in_groups_of): (defn groups-of Returns coll in groups of x size, optionally padding any remaining slots with specified

Re: FAQ

2008-12-19 Thread Jason
Not sure if the FAQ is the right place to put it, but I haven't seen any mention of this gotcha which could really trip some people up: http://w01fe.com/?p=32 Short version: hashing immutable Clojure collections that contain mutable Java objects can lead to confusing results. (Hi all, I'm new

Re: syntax philosophy

2008-12-19 Thread Meikel Brandmeyer
Hello Mark, On 19 Dez., 13:36, Mark Volkmann r.mark.volkm...@gmail.com wrote: If you don't need this, you don't have to use it. Ok. That was a stupid statement. But at least it is not the rationale for including condp (in whatever form). I feel very strongly that Clojure, and any

Re: syntax philosophy

2008-12-19 Thread Mark Volkmann
On Fri, Dec 19, 2008 at 6:52 AM, Meikel Brandmeyer m...@kotka.de wrote: Hello Mark, On 19 Dez., 13:36, Mark Volkmann r.mark.volkm...@gmail.com wrote: If you don't need this, you don't have to use it. Ok. That was a stupid statement. But at least it is not the rationale for including

Re: IntelliJ Plugin now on Google Code

2008-12-19 Thread Randall R Schulz
Peter, Great news! On Friday 19 December 2008 05:36, Peter Wolf wrote: For those who are following or helping my efforts (thank you), the IntelliJ Clojure plugin code is now on GoogleCode. Enjoy! http://code.google.com/p/clojure-intellij-plugin/source/browse/#svn/t

Re: groups-of

2008-12-19 Thread Michael Wood
On Fri, Dec 19, 2008 at 1:02 PM, hosia...@gmail.com hosia...@gmail.com wrote: I'm learning Clojure by trying to implement some functions from Ruby core/stdlib/ActiveSupport's core_ext. The first one I wrote is groups-of (similar to ActiveSupport's in_groups_of): (defn groups-of Returns

Re: A more useful assert macro

2008-12-19 Thread Stuart Halloway
While we are talking about assert: I recently wanted for assert to return the value of the expression, so I could embed asserts inside a Fact test and get detailed reporting about what failed. I checked a few other functional languages and none of their asserts return a value either. This

Re: groups-of

2008-12-19 Thread Rich Hickey
On Dec 19, 8:59 am, Michael Wood esiot...@gmail.com wrote: On Fri, Dec 19, 2008 at 1:02 PM, hosia...@gmail.com hosia...@gmail.com wrote: I'm learning Clojure by trying to implement some functions from Ruby core/stdlib/ActiveSupport's core_ext. The first one I wrote is groups-of

Re: groups-of

2008-12-19 Thread Michael Wood
On Fri, Dec 19, 2008 at 4:32 PM, Rich Hickey richhic...@gmail.com wrote: On Dec 19, 8:59 am, Michael Wood esiot...@gmail.com wrote: On Fri, Dec 19, 2008 at 1:02 PM, hosia...@gmail.com hosia...@gmail.com wrote: I'm learning Clojure by trying to implement some functions from Ruby

Re: groups-of

2008-12-19 Thread Michael Wood
On Fri, Dec 19, 2008 at 4:35 PM, Michael Wood esiot...@gmail.com wrote: On Fri, Dec 19, 2008 at 4:32 PM, Rich Hickey richhic...@gmail.com wrote: On Dec 19, 8:59 am, Michael Wood esiot...@gmail.com wrote: [...] There is a function called partition in Clojure's core.clj that does this, except

Re: A more useful assert macro

2008-12-19 Thread jdz
On Dec 19, 4:27 pm, Stuart Halloway stuart.hallo...@gmail.com wrote: While we are talking about assert: I recently wanted for assert to   return the value of the expression, so I could embed asserts inside a   Fact test and get detailed reporting about what failed. I checked a few other

contrib updated to use latest test-is

2008-12-19 Thread Stuart Halloway
Hi all, I have made a small commit [1] to clojure-contrib that gets most of clojure.contrib.test-clojure working again. Hopefully this will enable people to contribute more tests. (J., evaluation.clj was more complicated to fix so I have temporarily disabled it.) I hope to be in the IRC

Re: groups-of

2008-12-19 Thread Chouser
On Fri, Dec 19, 2008 at 9:37 AM, Michael Wood esiot...@gmail.com wrote: On Fri, Dec 19, 2008 at 4:35 PM, Michael Wood esiot...@gmail.com wrote: hmmm... if I do this: user= (partition 2 1 (iterate inc 1)) (.printStackTrace *e) it ends like this: [...] 57) (587257 587258) (587258

Re: Preparing for Release 1.0 (was: Re: 20081217 Release)

2008-12-19 Thread Bill Clementson
Hi Meikel, On Thu, Dec 18, 2008 at 11:18 PM, Meikel Brandmeyer m...@kotka.de wrote: On 19 Dez., 02:10, bc billc...@gmail.com wrote: For clojure-contrib, it would make sense to create a matching tarball whenever a Clojure release occurs. For the other 3, it would be necessary for someone to

Re: Circular Require Change?

2008-12-19 Thread Cosmin Stejerean
On Fri, Dec 19, 2008 at 10:30 AM, Kevin Martin martink...@gmail.com wrote: Thanks Rich! I'll keep an eye on the defect(shame there isn't a watch feature on google code). Other than this little minor annoyance, the new AOT changes are working great. Thanks for all the work, I'm really

Re: Circular Require Change?

2008-12-19 Thread Randall R Schulz
On Friday 19 December 2008 09:10, Cosmin Stejerean wrote: On Fri, Dec 19, 2008 at 10:30 AM, Kevin Martin martink...@gmail.com wrote: Thanks Rich! I'll keep an eye on the defect(shame there isn't a watch feature on google code). Other than this little minor annoyance, the new AOT changes

Re: Circular Require Change?

2008-12-19 Thread Meikel Brandmeyer
Hi, Am 19.12.2008 um 18:19 schrieb Randall R Schulz: Have you been able to make it work? It doesn't for me, and I am logged in. Is there a trick? Stuart H. managed to make it work somehow. He said something about using Firebug to figure it out. Starring works for me (Safari on Mac Windows).

Re: Persistent storage

2008-12-19 Thread evins.mi...@gmail.com
On Dec 18, 7:18 pm, Mark McGranaghan mmcgr...@gmail.com wrote: I've likewise though a fair bit about this, but haven't been able to come up with a particularly satisfying solution. One approach I've considered is a watcher-type system where persistence is defined in terms of immutable

Clojure vs. CL macros question

2008-12-19 Thread Stuart Halloway
According to Paul Graham's On Lisp, macroexpanders should be purely functional, and you should not count on how often a macro gets expanded. This seems like a reasonable restriction for Clojure too. However, Chouser posted an example that shows the expansion of proxy does have a side

Re: Microsoft SQL Server and the sql contrib

2008-12-19 Thread Tom Emerson
On Tue, Dec 16, 2008 at 1:15 PM, Scott Jaderholm jaderh...@gmail.com wrote: I'm trying to use the sql contrib with Microsoft SQL Server Express 2005. I've used the jTDS driver for SQL Server 2005 (not Express) without any problems, so if you still have problems with the Microsoft driver you may

Re: Clojure vs. CL macros question

2008-12-19 Thread Stuart Sierra
I think it's a generally good idea for macros to be purely functional, but it's not always a requirement. As long as Clojure remains exclusively a compiler and not an interpreter (unlike some CL implementations) I think it is safe to assume that macros will only run at compile time. -S On Dec

Stumped - Java hangs when using Swing in Slime

2008-12-19 Thread levand
I noticed this first with a project I'm working on, and verified that it is happening as well with the temperature converter demo on the clojure site. After I run the file from within Slime, after a few seconds my Swing gui stops responding, and the Repl as well. Apparently, the whole Java

def in caller namespace from a macro

2008-12-19 Thread John D. Hume
I'm learning macros, and I've figured something out that works for what I want to do but looks awfully weird. Is this a hacky mess because I don't know the clean way to do it or an idiom I just need to get used to? I want a macro expansion to define some functions in the namespace of the caller.

*compile-path* hardwired in compiled Clojure core

2008-12-19 Thread Stuart Sierra
Hi Rich all, While compiling Clojure, It seems that *compile-path* is being set to the absolute path to classes within the Clojure source distribution. That is: unzip clojure_20081217.zip cd clojure java -jar clojure.jar Clojure user= *compile-path* /Users/rich/dev/clojure/classes And it

Re: def in caller namespace from a macro

2008-12-19 Thread Meikel Brandmeyer
Hi, Am 19.12.2008 um 21:25 schrieb John D. Hume: (ns foo) (defmacro defthing [s] (let [thing-name 'thing] `(def ~thing-name (format the %s thing ~s Simply put 'thing directly into the syntax-quote: (defmacro defthing [s] `(def ~'thing (format the %s thing ~s))) But be sure to

Re: Stumped - Java hangs when using Swing in Slime

2008-12-19 Thread .Bill Smith
Possibly related: http://groups.google.com/group/clojure/browse_thread/thread/161d608ccb1e8b3d/76eadda70df674a4?lnk=gstq=swing+hang#76eadda70df674a4 Bill On Dec 19, 2:18 pm, levand luke.vanderh...@gmail.com wrote: I noticed this first with a project I'm working on, and verified that it is

Re: CLI launcher (was: Superficial barriers to entry)

2008-12-19 Thread Tom Emerson
On Thu, Dec 18, 2008 at 12:56 PM, Phil Hagelberg technoma...@gmail.com wrote: This was one of the most disorienting things I encountered when starting with clojure. I'm used to codebases providing a bin/ directory or at least a shell script to start from. It wouldn't be so bad if the java CLI

Re: Stumped - Java hangs when using Swing in Slime

2008-12-19 Thread Daniel Eklund
Anyone have any ideas? I'm pretty confused as to what might be going on. Some sort of deadlock in the thread pool that isn't allowing the AWT event thread any cycles? I'm looking at the thread pool in JSwat and I see a lot of Swank threads, but I can't tell exactly what's going on. I

Re: Blogging About Clojure?

2008-12-19 Thread Tom Emerson
On Tue, Dec 16, 2008 at 2:05 PM, Randall R Schulz rsch...@sonic.net wrote: Does anyone have any recommendations? I use WordPress on my site and like it a lot: does everything I need, and then some I suspect. wordpress.com will host your blog for free, I think. Also blogger.com (owned by

subset?

2008-12-19 Thread Andrew Baine
Since sets are callable like functions, subset? can be written pretty concisely: user (defn subset? [a b] (every? b a)) It handles the empty set cases correctly and everything. Is this already in clojure-contrib? Want it and its brethren superset? proper- subset? proper-superset? in there?

Re: subset?

2008-12-19 Thread Andrew Baine
I should note that this also works because of sets being seq-able. Since they're callable, we can use b as the predicate in every?; since they're seq-able we can use a as the coll in every?. Very cool! On Dec 19, 1:46 pm, Andrew Baine andrew.ba...@gmail.com wrote: Since sets are callable like

Re: Blogging About Clojure?

2008-12-19 Thread Daniel E. Renfer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 12/19/2008 04:23 PM, Tom Emerson wrote: On Tue, Dec 16, 2008 at 2:05 PM, Randall R Schulz rsch...@sonic.net wrote: Does anyone have any recommendations? I use WordPress on my site and like it a lot: does everything I need, and then some I

Re: The return of the monads: lessons learned about macros

2008-12-19 Thread jim
Konrad, Glad to know we were on the same page about monad transformers. That transformer was indeed a translation from the Haskell implementation. Using 'with-monad' does clean it up. I'll have to take a look at your implementation of m-bind. I did prefer the conciseness and the fact that it

dissoc-in?

2008-12-19 Thread kwatford
I've been using assoc-in, get-in, etc, to work with nested maps, but I recently needed a dissoc-in to free up unneeded indexes and such. I didn't see one, so does this look about right? (defn dissoc-in [m keys] (if (= (count keys) 1) (dissoc m (first keys)) (let [k (last keys)

doc strings for multimethods?

2008-12-19 Thread Jason
Am I mistaken, or is there currently no nice syntax for giving doc strings to methods? Sure, I can do (defmulti #^{:doc documentation} my-method my-dispatch-fn) but for consistency with defn and defmacro it would be nice to have a direct way to document multimethods. Even better would be a

Re: Blogging About Clojure?

2008-12-19 Thread Phil Hagelberg
Jason jawo...@berkeley.edu writes: I'm in the same boat: I just set up my first blog yesterday so I could post some gotchas i've found and experiments i've done with clojure. I went the route David suggests: dreamhost.com has a special now, $10 for a domain and 6 months free hosting, and

Re: CLI launcher

2008-12-19 Thread Phil Hagelberg
Tom Emerson tremer...@gmail.com writes: On Thu, Dec 18, 2008 at 12:56 PM, Phil Hagelberg technoma...@gmail.com wrote: This was one of the most disorienting things I encountered when starting with clojure. I'm used to codebases providing a bin/ directory or at least a shell script to start

Re: Blogging About Clojure?

2008-12-19 Thread Jason
I host my blog on Dreamhost, and it works great for static files, though if you're looking to host actual clojure apps DH won't cut it. Yeah, Java hosting seems like rather tricky business, since you basically need dedicated RAM. I've heard slicehost is very good and reasonably priced in that

Re: Listen on changes to refs

2008-12-19 Thread Rowdy Rednose
Apart from being blasphemous - would it be a good idea to override clojure.lang.Ref in Java land? I want to create (children of?) refs in clojure that send an agent when they change, so that I can create facilities to observe changes to them. Creating a 'MyRef extends Ref' seems to be the

Re: Blogging About Clojure?

2008-12-19 Thread Eric Lavigne
I host my blog on Dreamhost, and it works great for static files, though if you're looking to host actual clojure apps DH won't cut it. Yeah, Java hosting seems like rather tricky business, since you basically need dedicated RAM. I've heard slicehost is very good and reasonably priced in

Re: Listen on changes to refs

2008-12-19 Thread Rowdy Rednose
Validators seem like an easy way to do it, I'll try that. Thanks Chouser! Afaik Rich only thinks about adding watchers to refs currently, and I can't find it in the list: http://code.google.com/p/clojure/issues/list?can=2q=colspec=ID+Type+Status+Priority+Reporter+Owner+Summarycells=tiles So it

Re: syntax philosophy

2008-12-19 Thread Mon Key
I have a strong dislike for the concept of TIMTOWTDI (There is more than one way to do it . This should be a guiding design goal for any core lisp devel. Get the core right and TIMTOWTDI is a `side effect' of good design rather than the inverse. s_P On Dec 19, 7:36 am, Mark Volkmann

Re: Clojure vs. CL macros question

2008-12-19 Thread Mon Key
This seems like a reasonable restriction for Clojure too. Third rule. Macros break the rules. Don't place arbitrary restrictions on rule breaking :P s_P On Dec 19, 2:05 pm, Stuart Halloway stuart.hallo...@gmail.com wrote: According to Paul Graham's On Lisp, macroexpanders should be purely  

Re: Persistent storage

2008-12-19 Thread Mon Key
Hans Hubner's BKNR framework for CL explores this in a very interesting way - while relying on CLOS meta-object protocol the ideas could prob. be extended to Clojure. With some ABCL interaction this would make CL - Clojure || Clojure - CL interop possible at the JVM level with persistence...

multiple sets on one item - is this a good idea?

2008-12-19 Thread chris
Hello, I am gearing up to write some swing code, specifically some stuff where I want to use the grid bag layout system, and I remember something I hated about java: --c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0.5; c.gridx = 2; c.gridy = 0; -- You repeated c all over the place so you

Help Needed Getting Clojure-Mode working with XEmacs

2008-12-19 Thread CuppoJava
Hi everyone, I'm trying to get clojure-mode working under XEmacs and am having troubles. I managed to get it working under GNU Emacs with the following .emacs file: (setq inferior-lisp-program java -cp C:/clojure/trunk/clojure.jar clojure.lang.Repl) (add-to-list 'load-path C:/program