Re: On macros

2008-10-21 Thread Stephen C. Gilardi
On Oct 22, 2008, at 12:43 AM, Krukow wrote: > Ok, thanks. I'm still a bit unsure as to how to think about it > conceptually. I made the following experiment in the REPL > > user> (eval (list (symbol "Object."))) > [EMAIL PROTECTED] > user> > > This seems to indicate that actually Object. is just

Re: On macros

2008-10-21 Thread mb
Hi Karl, On 22 Okt., 06:43, Krukow <[EMAIL PROTECTED]> wrote: > user> (eval (list (symbol "Object."))) > [EMAIL PROTECTED] > user> > > This seems to indicate that actually Object. is just a symbol like any > other. So there isn't any special reader support for it, but instead > the compiler handl

Re: On macros

2008-10-21 Thread Krukow
On Oct 21, 8:28 pm, "J. McConnell" <[EMAIL PROTECTED]> wrote: > There is special reader support for it. It cannot, and isn't, > implemented as a macro, which is why you couldn't find it in boot.clj. > It is implemented in Java. Ok, thanks. I'm still a bit unsure as to how to think about it conc

Re: Multi-methods dispatch function. Inheritance Question.

2008-10-21 Thread CuppoJava
Never mind, Rich already took this into account, and multiple-dispatch already works perfectly. Now that's seriously cool! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send e

Multi-methods dispatch function. Inheritance Question.

2008-10-21 Thread CuppoJava
Hi, Is there an elegant way of expressing multiple-dispatch (with support for inheritance) with Clojure's multimethod system? ie. (defmulti get-length :class) (defmethod get-length :shape [] (bla bla bla)) get-length can be called by any map who's :class is derived from :shape. But what if we

Re: offtopic - where are you come from? (poll)

2008-10-21 Thread guillaume faure
Clermont-Ferrand, France --~--~-~--~~~---~--~~ 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 email to [EMAIL PROTECTED]

Re: Find lines matching regexp in large text file - performance suggestions welcome

2008-10-21 Thread Chouser
On Tue, Oct 21, 2008 at 11:24 AM, Mathias Dahl <[EMAIL PROTECTED]> wrote: > > Today I came up with this: > > (defn locate-lines [regexp] > (let [pattern (. java.util.regex.Pattern > (compile regexp >(. java.util.regex.Pattern > CASE_INSENSITIVE)))] >

Re: Modified doto

2008-10-21 Thread mb
Hello, On 21 Okt., 19:08, Chouser <[EMAIL PROTECTED]> wrote: > Here's my implementation: > > (defmacro >>_ [& exprs] > (list 'let (apply vector (mapcat (fn [expr] (list '_ expr)) exprs)) '_ )) Now this is a nice idea. > I used it a couple times after first writing it, but have since failed > t

Re: Modified doto

2008-10-21 Thread Martin DeMello
On Oct 21, 5:41 am, mb <[EMAIL PROTECTED]> wrote: > > It allows the full support of doto via the dot notation of > methods. And it supports on the other hand other functions > not only methods. One example is the new miglayout > interface in clojure-contrib. Thanks! That's going to be really usef

Re: offtopic - where are you come from? (poll)

2008-10-21 Thread Christopher Taylor
ok, trying again... here's a hello from Berlin, Germany :) On 21.10.2008 2:11 Uhr, Dirk Vleugels wrote: > Duesseldorf& Hamburg, Germany > > Cheers, > Dirk > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clo

On macros

2008-10-21 Thread Krukow
I was watching one of the presentation videos for Java programmers. Rich mentions that ClassName. is a macro for (new ClassName), e.g., user> (macroexpand '(Object.)) (new Object) user> I was wondering how this can be implemented as a macro (couldn't find it in boot.clj). As far as I can see,

Re: On macros

2008-10-21 Thread .Bill Smith
> Also, if someone could explain how it is possible that defmacro itself > is a macro Not sure I understand your question. Since you looked in boot.clj, I assume you saw the definition of defmacro. In my boot.clj (a little bit out of date), it looks like this: (def #^{:doc "Like defn, but th

Re: On macros

2008-10-21 Thread J. McConnell
On Tue, Oct 21, 2008 at 2:20 PM, Krukow <[EMAIL PROTECTED]> wrote: > > I was watching one of the presentation videos for Java programmers. > Rich mentions that > > ClassName. is a macro for (new ClassName), > > e.g., > > user> (macroexpand '(Object.)) > (new Object) > user> > > I was wondering how

Re: Modified doto

2008-10-21 Thread Timothy Pratley
> Any thoughts? Awesome! :) --~--~-~--~~~---~--~~ 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 email to [EMAIL PROTE

Re: importing clojure.contrib.miglayout

2008-10-21 Thread Parth Malwankar
On Oct 21, 8:30 pm, "J. McConnell" <[EMAIL PROTECTED]> wrote: > On Tue, Oct 21, 2008 at 11:19 AM, Parth Malwankar > > <[EMAIL PROTECTED]> wrote: > > > I am trying to import clojure.contrib.miglayout. The simple "import" > > seems to work fine, but the moment I use ":require"  it fails. > > Am I

Re: Modified doto

2008-10-21 Thread Sean Spencer
I also thought it was in the language and I just didn't know the name. Good to see it added! And "do-with" sounds like a good name to me. On Tue, Oct 21, 2008 at 12:33 PM, CuppoJava <[EMAIL PROTECTED]>wrote: > > +1 for do-with for me as well. > > Thank you for considering adding this to Clojure

Re: unit tests

2008-10-21 Thread Timothy Pratley
Ah of course! 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] Fo

Re: Modified doto

2008-10-21 Thread Chouser
On Tue, Oct 21, 2008 at 11:31 AM, mb <[EMAIL PROTECTED]> wrote: > > (xxx-> "Hello" (apply str <> [", " "World!"])) gives "Hello, World!". > > The <> is used to mark the "hole" where the value is to be inserted. I wrote something like this too. I called mine >>_ and used _ as the insert mark. He

Re: unit tests

2008-10-21 Thread Stuart Halloway
Hi Tim, You have run afoul of the automagical conversion between Lispy "-" and Javaish "_": ' sad (use 'clojure.contrib.test_is) java.lang.Exception: namespace 'clojure.contrib.test_is' not found after loading '/clojure/contrib/test_is/test_is.clj' (NO_SOURCE_FILE:0 ; happy user=> (use 'clo

Re: unit tests

2008-10-21 Thread J. McConnell
On Tue, Oct 21, 2008 at 12:34 PM, Timothy Pratley <[EMAIL PROTECTED]> wrote: > > I'm a bit stuck on how to load test_is... > I've added a tiny section to the wiki because I couldn't find any > instructions on using contrib, and well I made a lot of mistakes along > the way that other people might

[EMAIL PROTECTED]

2008-10-21 Thread Dustin Withers
Rich, I just wanted to thank you for your presentation at Lisp50. The excitement that was created from your presentation was amazing. I believe that this is the beginning of a resurgence of Lisp in the market and I think Clojure is leading the way. After last nights events I hope to see more peop

Re: unit tests

2008-10-21 Thread Timothy Pratley
> There's a simple unit testing library in clojure.contrib.test-is. > Look at the source code comments there for examples of how you can > define tests. Thanks Stuart S, I did a subversion grab of the source and well that looks extreemly useful. I'm a bit stuck on how to load test_is... I've add

Re: Modified doto

2008-10-21 Thread CuppoJava
+1 for do-with for me as well. Thank you for considering adding this to Clojure. I actually wrote this macro myself, but I've always thought it was in the API already and I just didn't know what it was called. --~--~-~--~~~---~--~~ You received this message because

Re: Modified doto

2008-10-21 Thread Rastislav Kassak
I vote for "do-with" too. I used to upgrade my Ruby runtime with Ola Bini's Kernel::with. It could be used exactly the same way as proposed do-with. However, do-with is more idiomatic name, IMHO. RK On 10/21/08, J. McConnell <[EMAIL PROTECTED]> wrote: > > > On 21 Okt., 17:24, Chouser <[EMAIL PR

Re: Modified doto

2008-10-21 Thread CuppoJava
If I understand the macro correctly, it takes an argument, and then inserts it as the second element into all of the following lists right? How about the name "with"? (with obj (. doSomething) (. doSomethingElse) (print stdOut)) I think i'm stealing it from Ruby, but i'm not sure. It's bee

Re: Modified doto

2008-10-21 Thread J. McConnell
> On 21 Okt., 17:24, Chouser <[EMAIL PROTECTED]> wrote: >> I don't see much wrong with "doto->", though "do-with" or "do->" might >> be okay. I'd probably vote against "do-unto-others-as" > I would vote for do-with. + 1 --~--~-~--~~~---~--~~ You received this mes

Re: Modified doto

2008-10-21 Thread mb
Hi, On 21 Okt., 17:24, Chouser <[EMAIL PROTECTED]> wrote: > I don't see much wrong with "doto->", though "do-with" or "do->" might > be okay.  I'd probably vote against "do-unto-others-as" I would vote for do-with. Sincerely Meikel --~--~-~--~~~---~--~~ You receiv

Re: Modified doto

2008-10-21 Thread mb
Hello Stephen, On 21 Okt., 17:05, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > Is the ".." aspect of it the "automatically make a list if it's not   > one" part? This is actually a -> aspect. What I meant was: (.. x (getModel) (getRoot) (state)) is equivalent to (-> x .getModel .getRoot .sta

Re: importing clojure.contrib.miglayout

2008-10-21 Thread J. McConnell
On Tue, Oct 21, 2008 at 11:19 AM, Parth Malwankar <[EMAIL PROTECTED]> wrote: > > I am trying to import clojure.contrib.miglayout. The simple "import" > seems to work fine, but the moment I use ":require" it fails. > Am I doing something wrong here or is this a bug? > Seems to work for other modul

Find lines matching regexp in large text file - performance suggestions welcome

2008-10-21 Thread Mathias Dahl
Today I came up with this: (defn locate-lines [regexp] (let [pattern (. java.util.regex.Pattern (compile regexp (. java.util.regex.Pattern CASE_INSENSITIVE)))] (debug (str "pattern: " pattern)) (with-open r (new java.io.LineNumberReader

Re: Modified doto

2008-10-21 Thread Chouser
On Tue, Oct 21, 2008 at 11:13 AM, J. McConnell <[EMAIL PROTECTED]> wrote: > > I like "with", that's what JavaScript uses IIRC. I think JavaScript's "with" means something slightly different. I don't remember about Ruby. But as Stephen pointed out, this is only useful when the methods (or functi

importing clojure.contrib.miglayout

2008-10-21 Thread Parth Malwankar
Hello, I am trying to import clojure.contrib.miglayout. The simple "import" seems to work fine, but the moment I use ":require" it fails. Am I doing something wrong here or is this a bug? Seems to work for other modules like pred and command_line. [parth:~]% clj Clojure user=> (ns test (:refer-

Re: Modified doto

2008-10-21 Thread J. McConnell
I like "with", that's what JavaScript uses IIRC. - J. On Tue, Oct 21, 2008 at 11:10 AM, CuppoJava <[EMAIL PROTECTED]> wrote: > > If I understand the macro correctly, it takes an argument, and then > inserts it as the second element into all of the following lists > right? > How about the name "w

Re: Debugging with JSwat

2008-10-21 Thread Allen Rohner
> I wonder if this doesn't have something to do with the fact that I'm > doing everything via the REPL. Is it possible to break on code you've > evaluated via M-x slime-eval-buffer? I'm able to set breakpoints in > (e.g.) boot.clj. I think it does. The compiler associates a file name line number

Re: Modified doto

2008-10-21 Thread Stephen C. Gilardi
On Oct 21, 2008, at 8:41 AM, mb wrote: > I'd like to propose the following chimera of doto and ->. > > (defmacro doto-> > [obj & forms] > (let [objx (gensym "obj__")] >`(let [~objx ~obj] > (do > ~@(map (fn [f] > (if (seq? f) >`(~(first f) ~

Re: unit tests

2008-10-21 Thread Timothy Pratley
Thanks Stuart, That's exactly what I was after. On Oct 21, 11:05 pm, Stuart Halloway <[EMAIL PROTECTED]> wrote: > Hi Tim, > > Example below. This is from a demo porting Java code to Clojure, the   > original Java code is in the Apache Commons [1]. Note that test does   > not resolve symbols: > >

Re: Testing Clojure (was Re: Bug? Strange set equality (r1075))

2008-10-21 Thread Stuart Halloway
Since there is now a movement afoot to write a comprehensive test suite, I want to re-post the spike I did earlier on ClojureCheck. It would be cool to use check-style tests for at least part of the Clojure suite. If there is interest in this, I hope to have time to work on this in late Nov

Re: Testing Clojure (was Re: Bug? Strange set equality (r1075))

2008-10-21 Thread J. McConnell
> That's great, J. Thanks. I want to use the wiki to coordinate efforts. I'll > be putting a page up in the next day or two. Sounds good. > Was the example I posted enough to get you started? I think so, it made sense to me. If I'm stumped (I'm thinking of load-file here) I'll be sure to ask qu

Re: Modified doto

2008-10-21 Thread mb
Hi, On 21 Okt., 14:41, mb <[EMAIL PROTECTED]> wrote: > (defmacro doto-> The name is actually also up to discussion. doto is already in use and this change is incompatible to "legacy" code. I couldn't come up with a good alternative... Sincerely Meikel --~--~-~--~~~---

Re: unit tests

2008-10-21 Thread Stuart Sierra
Hi Tim, There's a simple unit testing library in clojure.contrib.test-is. Look at the source code comments there for examples of how you can define tests. -Stuart Sierra On Oct 21, 7:57 am, Timothy Pratley <[EMAIL PROTECTED]> wrote: > I've noticed around the place a few hints at testing capabil

Re: Testing Clojure (was Re: Bug? Strange set equality (r1075))

2008-10-21 Thread Stephen C. Gilardi
On Oct 21, 2008, at 10:02 AM, J. McConnell wrote: >> I made a start on this today. I started with the Reader page at >> clojure.org and started making tests. > > Unless I hear that someone else has started, I guess I'll take a shot > at the Evaluation page next time I get a chance. That's great,

Re: Testing Clojure (was Re: Bug? Strange set equality (r1075))

2008-10-21 Thread J. McConnell
> I made a start on this today. I started with the Reader page at > clojure.org and started making tests. Unless I hear that someone else has started, I guess I'll take a shot at the Evaluation page next time I get a chance. - J. --~--~-~--~~~---~--~~ You receive

Re: Modified doto

2008-10-21 Thread Chouser
On Tue, Oct 21, 2008 at 8:41 AM, mb <[EMAIL PROTECTED]> wrote: > > (doto-> (new JFrame "Hello, World!") > (.setDefaultCloseOperation JFrame/EXIT_ON_CLOSE) > (miglayout SomeChild :AConstraint MoreChildren ...)) > > Any thoughts? Beautiful. I've found in practice that using doto seems okay at fi

Re: Beginners (and idiomatic Clojure)

2008-10-21 Thread Fogus
> The presentation videos on the net are excellent -- they are what > convinced my that Clojure is really worth learning, and learning well, My discovery came in a similar way. But they had the additional benefit of motivating me to buckle down and learn Emacs. ;) > However, to be really acces

Re: offtopic - where are you come from? (poll)

2008-10-21 Thread Michael Wood
On Fri, Oct 17, 2008 at 11:27 AM, Rastislav Kassak <[EMAIL PROTECTED]> wrote: > Hello Clojurians, > > I think after 1st year of Clojure life it's good to check how far has > Clojure spread all over the world. > > So wherever are you come from, be proud and say it. > > I'm from Slovakia. :) Cape T

Re: offtopic - where are you come from? (poll)

2008-10-21 Thread sysprv
>From Sri Lanka. Living and working in Norway. On Oct 21, 1:42 pm, "Christophe Grand" <[EMAIL PROTECTED]> wrote: > Saint-Etienne, France > > Christophe Grand > > On Mon, Oct 20, 2008 at 8:51 PM, lpetit <[EMAIL PROTECTED]> wrote: > > > Laurent PETIT, Bron (near Lyon), France > > > On Oct 20, 7:0

Modified doto

2008-10-21 Thread mb
Hi, recently I ran in the a limitation of doto, that it only invokes methods. However piping the object with -> does not work also, since it's semantics are more like .. . I'd like to propose the following chimera of doto and ->. (defmacro doto-> [obj & forms] (let [objx (gensym "obj__")]

Re: unit tests

2008-10-21 Thread Stuart Halloway
Hi Tim, Example below. This is from a demo porting Java code to Clojure, the original Java code is in the Apache Commons [1]. Note that test does not resolve symbols: ; don't do this (test 'index-of-any) -> :no-test ; do this (test #'index-of-any) -> :ok Cheers, Stuart [1] http://svn.apa

Re: Beginners (and idiomatic Clojure)

2008-10-21 Thread Stuart Halloway
Hi Krukow, The book will go electronic beta (60% complete) in early November, and should be available in print in March 2009. WRT to the case study, you are absolutely right. We will develop the Java and Clojure versions in parallel, so that neither one benefits unfairly from domain knowle

unit tests

2008-10-21 Thread Timothy Pratley
I've noticed around the place a few hints at testing capabilities such as (test v) and contrib having a run tests, but I'm at a bit of a loss as to how it fits together. If there is a good example I can take a look at please point me toward it. Generally what I've been doing is writting a test ca

Re: offtopic - where are you come from? (poll)

2008-10-21 Thread Christophe Grand
Saint-Etienne, France Christophe Grand On Mon, Oct 20, 2008 at 8:51 PM, lpetit <[EMAIL PROTECTED]> wrote: > > Laurent PETIT, Bron (near Lyon), France > > On Oct 20, 7:03 pm, Luc Prefontaine <[EMAIL PROTECTED]> > wrote: >> Montreal prov. of Québec in Canada >> >> Luc Préfontaine >> >> On Fri, 200

Re: offtopic - where are you come from? (poll)

2008-10-21 Thread Fogus
Washington, DC -m --~--~-~--~~~---~--~~ 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 email to [EMAIL PROTECTED] For mor

Re: Multiple return values

2008-10-21 Thread Fredrik Appelberg
On Tue, Oct 21, 2008 at 7:48 AM, Jeffrey Chu <[EMAIL PROTECTED]> wrote: > > Hi, > > If you really need multiple value calls, you can always try to emulate > parts of it with some fancy macros. I've hacked up a quick proof of > concept - I haven't gotten a chance to test it too much, but it seems >