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

2008-12-19 Thread Christophe Grand
chris a écrit : > 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 re

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 files/xe

Re: doc strings for multimethods?

2008-12-19 Thread Lauri Oherd
Docstrings for individual defmethods are not possible. You can find more info about it there: http://groups.google.com/group/clojure/msg/f7751913e875953f Lauri On Sat, Dec 20, 2008 at 3:05 AM, Jason wrote: > > Am I mistaken, or is there currently no nice syntax for giving doc > strings to metho

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 d

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... So

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 wrote: > According to Paul Graham's On Lisp, macroexpanders should be purely   > functional, and you sh

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" wrote

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=2&q=&colspec=ID+Type+Status+Priority+Reporter+Owner+Summary&cells=tiles So i

Re: Listen on changes to refs

2008-12-19 Thread Rowdy Rednose
To give some structure to my previous questions - How would I make refs, that I'm interested in, send an agent on every change, without having to do that manually? A: Extend the Ref class (either in Clojure land or in Java land) B: overload/overwrite (however that would be achieved in Clojure) th

Re: Listen on changes to refs

2008-12-19 Thread Chouser
On Fri, Dec 19, 2008 at 8:35 PM, Rowdy Rednose wrote: > > 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 chang

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 pric

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 obvious

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 tha

Re: CLI launcher

2008-12-19 Thread Phil Hagelberg
"Tom Emerson" writes: > On Thu, Dec 18, 2008 at 12:56 PM, Phil Hagelberg > 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

Re: Blogging About Clojure?

2008-12-19 Thread Phil Hagelberg
Jason 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 they have a one-clic

Re: Blogging About Clojure?

2008-12-19 Thread Jason
Hi Randall, 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 they have a one-click wordpress

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 w

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)

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

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 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. > >

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 wrote: > Since sets are callable like functions, subset? can

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: Blogging About Clojure?

2008-12-19 Thread Tom Emerson
On Tue, Dec 16, 2008 at 2:05 PM, Randall R Schulz 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 Google) looks to be qu

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 li

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 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 launcher were any

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=gst&q=swing+hang#76eadda70df674a4 Bill On Dec 19, 2:18 pm, levand wrote: > I noticed this first with a project I'm working on, and verified that > it is happening as well with the

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

*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

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.

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 proces

Re: FAQ

2008-12-19 Thread MattyDub
+1 to Mon Key's suggestions. Those are very FAQ-like questions. -Matt On Dec 19, 12:45 am, Mon Key wrote: > 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? > > - W

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 19

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 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 want to try that o

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 effec

Re: Persistent storage

2008-12-19 Thread evins.mi...@gmail.com
On Dec 18, 7:18 pm, "Mark McGranaghan" 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 snapshots and ap

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: 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 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 g

Re: Circular Require Change?

2008-12-19 Thread Cosmin Stejerean
On Fri, Dec 19, 2008 at 10:30 AM, Kevin Martin 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 enjoying Clojure. >

Re: Circular Require Change?

2008-12-19 Thread Kevin Martin
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 enjoying Clojure. On Dec 17, 6:45 am, Rich Hickey wrote: > On Dec 17, 12:43 am, Kev

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 wrote: > On 19 Dez., 02:10, bc 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 test and save off a copy o

Re: groups-of

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

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 m

Re: A more useful assert macro

2008-12-19 Thread jdz
On Dec 19, 4:27 pm, Stuart Halloway 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 functional languages and

Re: groups-of

2008-12-19 Thread Michael Wood
On Fri, Dec 19, 2008 at 4:35 PM, Michael Wood wrote: > On Fri, Dec 19, 2008 at 4:32 PM, Rich Hickey wrote: >> >> On Dec 19, 8:59 am, "Michael Wood" wrote: [...] >>> There is a function called partition in Clojure's core.clj that does >>> this, except it does not pad, but rather discards any inc

Re: groups-of

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

Re: groups-of

2008-12-19 Thread Rich Hickey
On Dec 19, 8:59 am, "Michael Wood" wrote: > On Fri, Dec 19, 2008 at 1:02 PM, 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 >

Re: IntelliJ Plugin now on Google Code

2008-12-19 Thread Peter Wolf
Hi Randall, I'd like to get it to the point where some set of features completely work before I release a plugin. I'd like to see at least coloring, parens matching and a REPL. For the moment you need to install the IntelliJ plugin development kit if you just want to try it. Of course, havi

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 s

Re: groups-of

2008-12-19 Thread Michael Wood
On Fri, Dec 19, 2008 at 1:02 PM, 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 coll in g

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 >runk/src/org/clojure

IntelliJ Plugin now on Google Code

2008-12-19 Thread Peter Wolf
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/trunk/src/org/clojure/intellij Please note that this code is nowhere near ready for use. Syntax col

Re: syntax philosophy

2008-12-19 Thread Mark Volkmann
On Fri, Dec 19, 2008 at 6:52 AM, Meikel Brandmeyer wrote: > > Hello Mark, > > On 19 Dez., 13:36, "Mark Volkmann" 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

Re: syntax philosophy

2008-12-19 Thread Meikel Brandmeyer
Hello Mark, On 19 Dez., 13:36, "Mark Volkmann" 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 programming language, > should

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 n

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 v

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 it

Re: A try on condp

2008-12-19 Thread Meikel Brandmeyer
Hi Mark, On 19 Dez., 13:12, "Mark Volkmann" 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. It comes fro

Re: A try on condp

2008-12-19 Thread Mark Volkmann
On Thu, Dec 18, 2008 at 5:26 PM, Meikel Brandmeyer 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 name

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 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: test-is possible bug in are

2008-12-19 Thread Mark Volkmann
On Thu, Dec 18, 2008 at 9:08 PM, Stuart Sierra wrote: > > On Dec 18, 6:05 pm, "Mark Volkmann" 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 template expression, > which is

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 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 would be non

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 excepti

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 a

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 th

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 wher