Re: gen-class questions

2008-12-10 Thread Michiel de Mare
Of course! Thanks a lot! On Dec 11, 7:23 am, "Chris Turner" <[EMAIL PROTECTED]> wrote: > Not sure about the other info you're looking for, but I think I can help > explain what's going on. All methods have an extra argument passed in > representing the object itself (usually called "this"). > > I

Re: gen-class questions

2008-12-10 Thread Chris Turner
Not sure about the other info you're looking for, but I think I can help explain what's going on. All methods have an extra argument passed in representing the object itself (usually called "this"). In your example, what you want is: (ns p.C (:gen-class :methods [[m [Object] void]])) (defn -m [thi

gen-class questions

2008-12-10 Thread Michiel de Mare
I'm trying to generate a Java class from Clojure with gen-class, but without much success. I've got the following code: (ns p.C (:gen-class :methods [[m [Object] void]])) (defn -m [o] (println (.. o getClass getName))) The signature of the m method is correct: javap p.C public class p.C extends

Re: Learning Clojure

2008-12-10 Thread Timothy Pratley
Hi Brian, > Rich talks about destructuring in the part about "let" on the "special > forms" page. Ah indeed, thanks for pointing that out :) > If you have any examples to add, please add them yourself (it is a wiki > page). You've given some really good reasons why I shouldn't mess with it *

Re: Patch: precompiling Clojure core sources in Ant build script

2008-12-10 Thread Bill Clementson
Hi Matt, FYI - Jeffrey Chu just sent me an email and the patch has now been applied to swank-clojure. - Bill On Wed, Dec 10, 2008 at 1:09 PM, Bill Clementson <[EMAIL PROTECTED]> wrote: > Hi Matt, > > On Wed, Dec 10, 2008 at 12:47 PM, MattyDub <[EMAIL PROTECTED]> wrote: >> >> I can confirm that

Re: In core structure editor, anyone?

2008-12-10 Thread John Newman
Some Noobian critique: Thread-local bindings also allow us to monkey-patch for the span of a local > context. Say we have a function *cat* which calls a function stored in a > Var; if a function *goat* is root-bound to the Var, then *cat* will > normally call *goat*; however, if we call *cat* in a

Re: throw-if with no exception class

2008-12-10 Thread Stephen C. Gilardi
On Dec 10, 2008, at 4:38 AM, Ralf Bensmann wrote: Being a Java trainer for a long time, we talk with students about the "handle-or-declare rule" in Java and the two types of exceptions: "checked" (declared) and "unchecked" (runtime). So I prefer using a RuntimeException because no exceptio

Re: In core structure editor, anyone?

2008-12-10 Thread rzeze...@gmail.com
On Dec 10, 3:59 pm, falcon <[EMAIL PROTECTED]> wrote: > Could you describe in-core editing a bit more?  Sounds interesting. > +1 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this grou

Re: Learning Clojure

2008-12-10 Thread Brian Will
Tim: Rich talks about destructuring in the part about "let" on the "special forms" page. The discussion of functions and basic syntax is deliberately delayed because of dependencies, e.g. evaluation can't really be understood without understanding the reader, and explaining the reader involves t

Re: Learning Clojure

2008-12-10 Thread Stephen C. Gilardi
On Dec 10, 2008, at 9:03 PM, Brian Will wrote: btw, you'll see a few notes I left in the text in square brackets where I wasn't sure on some point. If someone could address those questions, I'd appreciate it. [hmm, what are the chances of a false positive due to hash collision? are the odds

Re: Learning Clojure

2008-12-10 Thread Timothy Pratley
Hi Brian, Looks really good. > My intro is meant as a > sequential tour through the essential concepts, not a practical > tutorial. In particular, my examples are deliberately cursory and > abstract, and my API coverage is very minimal. I have some comments which may go beyond your desired scop

Re: Learning Clojure

2008-12-10 Thread Brian Will
Thanks for explaining the origin of "var" and "ref". An important thing you should do for learners is to explain their origin of odd/ cryptic names because that makes them much easier to remember. For example, no text on C I've ever read explains the meaning of standard library function names, lik

Re: swank/start-server

2008-12-10 Thread mosi
Sorry for starting a new thread, this should go to swank-clojure thread, I should get some sleep. http://groups.google.com/group/clojure/browse_thread/thread/793cf6e179db3752 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google G

swank/start-server

2008-12-10 Thread mosi
Hi, I got this message from Feng, thank you very much. Posting for future reference. Feng to me: swank-clojure had some major change since then. If you use latest git clone, you should replace swank/create-server with, (swank/start-server "/dev/null" :port 4005 :dont-close true) /dev/null

Re: Non-NS-qualified hierarchies

2008-12-10 Thread Rich Hickey
On Wed, Dec 10, 2008 at 12:45 AM, J. McConnell <[EMAIL PROTECTED]> wrote: > On Tue, Dec 9, 2008 at 7:05 PM, Rich Hickey <[EMAIL PROTECTED]> wrote: >> >> Thanks. I think it does a bit too much - I only want to relax the >> requirement for namespace-qualification, not any of the other >> assertions

Re: Not understanding the proper use of map

2008-12-10 Thread Brian Carper
On Dec 10, 12:07 pm, "Michael Wood" <[EMAIL PROTECTED]> wrote: > OK, I think I know why this happens. It's treating the '+ as the key > for a map, and using the second integer as the default value. I'm not > sure why it treats an integer as a map, though: > Wow, that's a bit of a gotcha. It's

Re: Learning Clojure

2008-12-10 Thread Rich Hickey
On Wed, Dec 10, 2008 at 4:32 PM, Brian Will <[EMAIL PROTECTED]> wrote: > > A Java reference type is basically any type allocated on the heap. The > four Clojure reference types are particular Java reference types. My > complaint is this is exactly the sort of weirdness that causes > learners to sc

Re: Learning Clojure

2008-12-10 Thread J. McConnell
On Wed, Dec 10, 2008 at 4:32 PM, Brian Will <[EMAIL PROTECTED]> wrote: > > A Java reference type is basically any type allocated on the heap. The > four Clojure reference types are particular Java reference types. My > complaint is this is exactly the sort of weirdness that causes > learners to sc

Re: In core structure editor, anyone?

2008-12-10 Thread Drew Olson
On Wed, Dec 10, 2008 at 4:10 PM, J. McConnell <[EMAIL PROTECTED]> wrote: > > On Wed, Dec 10, 2008 at 4:06 PM, Chouser <[EMAIL PROTECTED]> wrote: > > > > I'm a vim user, but although I don't envy the multitude of > > configuration issues it sound like emacs/slime/swank users seem to > > have, I'm c

Re: Not understanding the proper use of map

2008-12-10 Thread Ryan Neufeld
Thats the CL'ism I was hanging on to! Thanks for the amazing and prompt replies. On Dec 10, 1:59 pm, Dean Ferreyra <[EMAIL PROTECTED]> wrote: > Ryan Neufeld wrote: > > I've been working on learning Clojure after taking a course in Common > > Lisp and I am having some troubles translating a parti

Re: Learning Clojure

2008-12-10 Thread Brian Will
A Java reference type is basically any type allocated on the heap. The four Clojure reference types are particular Java reference types. My complaint is this is exactly the sort of weirdness that causes learners to scratch their heads. Not the biggest issue, sure, but this sort of thing is nice to

Dr. Dobbs: "It's Time to Get Good at Functional Programming"

2008-12-10 Thread Randall R Schulz
Hi, I just found this article on Dr. Dobbs' Web site. It's dated Dec 3rd of this year: - "It's Time to Get Good at Functional Programming" Subtitle: "Is it Finally Functional Programming's Turn?" Headings: - "FP: What It Is" - "Scala: A Hyb

Re: In core structure editor, anyone?

2008-12-10 Thread J. McConnell
On Wed, Dec 10, 2008 at 4:06 PM, Chouser <[EMAIL PROTECTED]> wrote: > > I'm a vim user, but although I don't envy the multitude of > configuration issues it sound like emacs/slime/swank users seem to > have, I'm certainly a bit envious of the deep integration between repl > and editor. > > I wish

Re: Learning Clojure

2008-12-10 Thread Cosmin Stejerean
On Wed, Dec 10, 2008 at 2:10 PM, Randall R Schulz <[EMAIL PROTECTED]> wrote: > > On Wednesday 10 December 2008 10:27, Brian W wrote: > > I've created a new Clojure intro at > > http://en.wikibooks.org/wiki/Learning_Clojure. ... > > > > ... > > > > Another issue I had is we don't have a good blanke

Re: Patch: precompiling Clojure core sources in Ant build script

2008-12-10 Thread Bill Clementson
Hi Matt, On Wed, Dec 10, 2008 at 12:47 PM, MattyDub <[EMAIL PROTECTED]> wrote: > > I can confirm that that patch fixed my problem - I can now M-. to > render-place. Thanks, Bill! Good to hear that the patch fixes the issue for you. > What paths does slime-edit-definition search for the defin

Re: In core structure editor, anyone?

2008-12-10 Thread Chouser
On Wed, Dec 10, 2008 at 4:01 PM, J. McConnell <[EMAIL PROTECTED]> wrote: > > On Wed, Dec 10, 2008 at 3:35 PM, Chouser <[EMAIL PROTECTED]> wrote: >> >> It's by no means emacs *or even vim* yet > > Ouch, that hurts ;) I'm a vim user, but although I don't envy the multitude of configuration issues i

Re: In core structure editor, anyone?

2008-12-10 Thread J. McConnell
On Wed, Dec 10, 2008 at 3:35 PM, Chouser <[EMAIL PROTECTED]> wrote: > > It's by no means emacs *or even vim* yet Ouch, that hurts ;) - J. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to

Re: In core structure editor, anyone?

2008-12-10 Thread falcon
Could you describe in-core editing a bit more? Sounds interesting. On Dec 10, 7:15 am, Simon Brooke <[EMAIL PROTECTED]> wrote: > I note people seem mainly to be using Emacs as an editing/development > environment for Clojure. But as people keep pointing out, Clojure is > homoiconic; the canonica

Re: Patch: precompiling Clojure core sources in Ant build script

2008-12-10 Thread MattyDub
I can confirm that that patch fixed my problem - I can now M-. to render-place. Thanks, Bill! What paths does slime-edit-definition search for the definitions? It's not finding the clojure macros/functions (like defn, dosync, etc.), so I must not have that path configured correctly. -Matt On

Re: Improved Maven Build

2008-12-10 Thread ivant
On Dec 5, 10:48 am, ivant <[EMAIL PROTECTED]> wrote: > I don't have the time right now, but I can try to build the pom in the > weekend. Alas, my maven-fu is not good enough to do that. --~--~-~--~~~---~--~~ You received this message because you are subscribed to t

Re: In core structure editor, anyone?

2008-12-10 Thread Chouser
On Wed, Dec 10, 2008 at 7:15 AM, Simon Brooke <[EMAIL PROTECTED]> wrote: > > I note people seem mainly to be using Emacs as an editing/development > environment for Clojure. But as people keep pointing out, Clojure is > homoiconic; the canonical source of a function is not a stream of > bytes read

Re: Not understanding the proper use of map

2008-12-10 Thread Dean Ferreyra
Ryan Neufeld wrote: > I've been working on learning Clojure after taking a course in Common > Lisp and I am having some troubles translating a particular Common > Lisp function to Clojure that uses mapping. > > We're defining a function that takes a function and two lists and > applies the functi

Re: In core structure editor, anyone?

2008-12-10 Thread Scott Fleckenstein
Seems like having something like this would be a good step towards supporting image-based development similar to Smalltalk. Whether that is a good thing or not is a different discussion ;) -Scott Fleckenstein On Dec 10, 8:16 am, Stuart Sierra <[EMAIL PROTECTED]> wrote: > On Dec 10, 7:15 am, Sim

Re: Learning Clojure

2008-12-10 Thread Randall R Schulz
On Wednesday 10 December 2008 10:27, Brian W wrote: > I've created a new Clojure intro at > http://en.wikibooks.org/wiki/Learning_Clojure. ... > > ... > > Another issue I had is we don't have a good blanket term for Vars, > Refs, Agents, and Atoms. Speaking of these, your article mentions and des

Re: Not understanding the proper use of map

2008-12-10 Thread Stephen C. Gilardi
On Dec 10, 2008, at 3:00 PM, Michael Wood wrote: The problem seems to be that you are quoting the +. Not sure why this is, but: user=> ('+ 1 4) 4 ('+ 1 4) is effectively (get 1 '+ 4) (doc get) - clojure.core/get ([map key] [map key not-found]) Returns the value

Re: Not understanding the proper use of map

2008-12-10 Thread Michael Wood
On Wed, Dec 10, 2008 at 10:00 PM, Michael Wood <[EMAIL PROTECTED]> wrote: [...] > The problem seems to be that you are quoting the +. Not sure why this is, > but: > > user=> ('+ 1 4) > 4 > user=> OK, I think I know why this happens. It's treating the '+ as the key for a map, and using the seco

Re: Learning Clojure

2008-12-10 Thread J. McConnell
On Wed, Dec 10, 2008 at 1:27 PM, Brian W <[EMAIL PROTECTED]> wrote: > > Another issue I had is we don't have a good blanket term for Vars, > Refs, Agents, and Atoms. Rich sometimes calls them "reference types", > but that term already has a different meaning in Java. I considered > "meta-reference

Re: Patch: precompiling Clojure core sources in Ant build script

2008-12-10 Thread Bill Clementson
Oops, that patch had my debugging statements in it. Here's the correct one to use. On Wed, Dec 10, 2008 at 11:44 AM, Bill Clementson <[EMAIL PROTECTED]> wrote: > Hi Matt, > > I had a bit of free time this morning, so I looked into this further > and came up with a patch (attached). I've forwarded

Re: Not understanding the proper use of map

2008-12-10 Thread Michael Wood
On Wed, Dec 10, 2008 at 8:05 PM, Ryan Neufeld <[EMAIL PROTECTED]> wrote: > > I've been working on learning Clojure after taking a course in Common > Lisp and I am having some troubles translating a particular Common > Lisp function to Clojure that uses mapping. > > We're defining a function that t

Clojure Job Openings

2008-12-10 Thread ethor...@enclojure.org
I ran this past Rich and since they are Clojure jobs, he gave me the green light to post this here: Thanks! Eric Great opportunity to join a dynamic environment and take part in the development of tools written for the Clojure programming language to enable us to achieve our vision of incorporat

Re: Patch: precompiling Clojure core sources in Ant build script

2008-12-10 Thread Bill Clementson
Hi Matt, I had a bit of free time this morning, so I looked into this further and came up with a patch (attached). I've forwarded the patch to Jeffrey as well, so it should find it's way into swank-clojure in due course. Cheers, Bill Clementson On Wed, Dec 10, 2008 at 9:57 AM, Bill Clementson <[

Not understanding the proper use of map

2008-12-10 Thread Ryan Neufeld
I've been working on learning Clojure after taking a course in Common Lisp and I am having some troubles translating a particular Common Lisp function to Clojure that uses mapping. We're defining a function that takes a function and two lists and applies the function to each two items in the list

Re: why can't I set! stuff in user.clj?

2008-12-10 Thread J. McConnell
On Wed, Dec 10, 2008 at 2:08 PM, Stephen C. Gilardi <[EMAIL PROTECTED]> wrote: > > Alternatively, we could make those hooks be functions that one can > (optionally) define in user.clj. The platform entry point would call them if > they exist: > (ns user) > (defn init > [] > (set! *compile-path

Re: My quest to modify a leaf node in an arbitrarily deep map (question posed)

2008-12-10 Thread Chouser
On Wed, Dec 10, 2008 at 2:13 PM, Daniel Eklund <[EMAIL PROTECTED]> wrote: > > > As an off-hand comment made without careful reading, I can imagine > there being great utility in a special reader-syntax for paths. XSLT > embeds xpath, and groovy embeds gpath. I am unsure at this point the > exact

Re: My quest to modify a leaf node in an arbitrarily deep map (question posed)

2008-12-10 Thread Daniel Eklund
> > user> (path-rebind nested-structure [:nested1 :nested2 :final-data] > > "new data") > > {:nested1 {:nested2 {:final-data "new data", :level 2}, :level > > 1}, :level 0} > > Congratulations, you've implemented 'assoc-in'  :-) > > user=> (assoc-in nested-structure [:nested1 :nested2 :final-data]

Re: My quest to modify a leaf node in an arbitrarily deep map (question posed)

2008-12-10 Thread Daniel Eklund
> > One thing I immediately ran up against were certain situations where > > I have a map and want to "modify" a value several levels deep into > > the hierarchy.  Imagine the following structure: > > > (def nested-structure { :level 0, > >                         :nested1 { :level 1, > >        

Re: My quest to modify a leaf node in an arbitrarily deep map (question posed)

2008-12-10 Thread Chouser
On Wed, Dec 10, 2008 at 1:40 PM, Daniel Eklund <[EMAIL PROTECTED]> wrote: > > user> (path-rebind nested-structure [:nested1 :nested2 :final-data] > "new data") > {:nested1 {:nested2 {:final-data "new data", :level 2}, :level > 1}, :level 0} Congratulations, you've implemented 'assoc-in' :-) use

Re: why can't I set! stuff in user.clj?

2008-12-10 Thread Stephen C. Gilardi
On Dec 10, 2008, at 1:50 PM, Stephen C. Gilardi wrote: - I think init.clj and repl-init.clj would be good additions to what we have now. I'll be happy to write the code if it's welcome. Alternatively, we could make those hooks be functions that one can (optionally) define in user.clj. The

Re: why can't I set! stuff in user.clj?

2008-12-10 Thread Stephen C. Gilardi
On Dec 10, 2008, at 8:51 AM, Stuart Halloway wrote: Thanks for the info. Is this limitation of user.clj arbitrary, or motivated by some concern that the average Clojure user should know about? Is the a reason not to load the bindings first? Does user.clj (in current form) do more harm than goo

Re: My quest to modify a leaf node in an arbitrarily deep map (question posed)

2008-12-10 Thread Randall R Schulz
On Wednesday 10 December 2008 10:40, Daniel Eklund wrote: > Hi all, > > ... > > One thing I immediately ran up against were certain situations where > I have a map and want to "modify" a value several levels deep into > the hierarchy. Imagine the following structure: > > (def nested-structure { :

My quest to modify a leaf node in an arbitrarily deep map (question posed)

2008-12-10 Thread Daniel Eklund
Hi all, I am relatively new to clojure. I am trying to port some toy code I wrote for common lisp a few years ago (a boggle-like game which needs a dictionary prefix trie to trim possible word matches). My old code was fairly imperative in nature when creating the dictionary trie, and so now I a

Learning Clojure

2008-12-10 Thread Brian W
I've created a new Clojure intro at http://en.wikibooks.org/wiki/Learning_Clojure. While Rich's screencasts and reference docs are great, they don't always lay things out in a digestible order. My intro is meant as a sequential tour through the essential concepts, not a practical tutorial. In par

Re: Patch: precompiling Clojure core sources in Ant build script

2008-12-10 Thread Bill Clementson
Hi Matt, Yes, you should let Jeffrey know about the bug. - Bill On Wed, Dec 10, 2008 at 9:20 AM, MattyDub <[EMAIL PROTECTED]> wrote: > > Thanks for confirming the bug, Bill. Should we post this to Jeffrey > Chu (assuming it's a swank-clojure issue)? What's the protocol at > this point? > -Mat

Re: Patch: precompiling Clojure core sources in Ant build script

2008-12-10 Thread MattyDub
Thanks for confirming the bug, Bill. Should we post this to Jeffrey Chu (assuming it's a swank-clojure issue)? What's the protocol at this point? -Matt On Dec 9, 11:03 pm, "Bill Clementson" <[EMAIL PROTECTED]> wrote: > Hi Matt, > > > > On Tue, Dec 9, 2008 at 6:43 PM, MattyDub <[EMAIL PROTECTED]

Re: In core structure editor, anyone?

2008-12-10 Thread Stuart Sierra
On Dec 10, 7:15 am, Simon Brooke <[EMAIL PROTECTED]> wrote: > But in-core structure editors are > extremely powerful and useful when editing homoiconic languages, so... > is anyone working on an in-core editor for Clojure? Not that I've heard, but Emacs + Paredit

Re: recur vs. lazy: establishing guidelines

2008-12-10 Thread Christophe Grand
Stuart Halloway a écrit : > But I bet that isn't the whole story. What are the counterarguments in > favor of non-lazy butlast? See http://clojure-log.n01se.net/date/2008-06-30.html#22:10b drop-last has been added to core.clj shortly after. I guess butlast was a quick expedient to help write so

Re: recur vs. lazy: establishing guidelines

2008-12-10 Thread kwatford
> Here is where I am: If your function creates/returns only atoms or   > fixed size collections, loop/recur is fine. I don't think you should use the word 'atom' in the discussion in the book. Lisp people will know what you mean, but Clojure's new 'atom' reference type makes that usage confusing

Re: why can't I set! stuff in user.clj?

2008-12-10 Thread Stuart Halloway
Hi Steve, Thanks for the info. Is this limitation of user.clj arbitrary, or motivated by some concern that the average Clojure user should know about? Is the a reason not to load the bindings first? Does user.clj (in current form) do more harm than good? Stuart > user.clj is loaded befor

In core structure editor, anyone?

2008-12-10 Thread Simon Brooke
I note people seem mainly to be using Emacs as an editing/development environment for Clojure. But as people keep pointing out, Clojure is homoiconic; the canonical source of a function is not a stream of bytes read from a file, but is a structure in core. Now, in-core editing does raise some iss

Re: throw-if with no exception class

2008-12-10 Thread Ralf Bensmann
Being a Java trainer for a long time, we talk with students about the "handle-or-declare rule" in Java and the two types of exceptions: "checked" (declared) and "unchecked" (runtime). So I prefer using a RuntimeException because no exception was specified. On Wed, Dec 10, 2008 at 3:46 AM, Mark Vol

Re: anyone experience with brics.automaton regex engine?

2008-12-10 Thread bOR_
Hired a monkey to hit random keys on my keyboard, and eventually figured out how to get the automaton working. RegExp r = new RegExp("ab(c|d)*"); Automaton a = r.toAutomaton(); String s = "abcccdc"; System.out.println("Match: " + a.run(s)); // prints: true (add-classpath "file:///home/boris/pro