Re: Problem using clojure.contrib.seq-utils

2009-04-18 Thread synphonix

Hello,

I have problems using seq-utils with the latest versions of clojure
and clojure-contrib.
I use clojure rev  1352 and clojure-contrib rev 675.
Using these two the first invocation of
(use 'clojure.contrib.seq-utils)
gives
java.lang.NoSuchMethodError: clojure.lang.MultiFn.init(Lclojure/lang/
IFn;Ljava/lang/Object;Lclojure/lang/IRef;)V(NO_SOURCE_FILE:0)
later invocations result in
java.lang.NoClassDefFoundError: Could not initialize class
clojure.contrib.seq_utils__init (NO_SOURCE_FILE:0)

This seems to be the cause why I cannot use compojure with the latest
versions of clojure/clojure contrib.
I poked a little in the clojure code and it seems that the changes in
MultiFn where introduced in clojure rev 1340.

Has someone seen similar problems and fixed them?

Regards

Poul
--~--~-~--~~~---~--~~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: The Path to 1.0

2009-04-18 Thread Timothy Pratley

I'm eager to see Clojure turn 1.0 because it is a fantastic language
that deserves to be even more popular than it already is. I believe it
is time to put the message out there that clj has made the journey
from something to toy with to a serious language or even the next
big thing. Clojure has already reached 1.0 maturity in my eyes
because:

1) There are large projects already using it
- Luc/Stuart have already done major deployments
- I'm quite amazed at the depth of the projects you get a peek of from
the group
- Heck Itay wrote a full clj IDE in 2 months which was really slick

2) My own experience
- I used to have to svn update regularly and check the group to code
in clj, for the last 2 months I've noticed no need for that anymore
- Bug reports seem to have dried up, and I don't encounter any ever (I
encounter my own bugs regularly still!)
- No radical diversions to core being discussed

3) Core language considerations
- All 1.0 discussion has been infrastructure related; indicates people
are comfortable with how the language itself looks
- Type systems is the only lively debate I've noticed on the group in
this area, and I don't see it holding 1.0 back
- http://code.google.com/p/clojure/issues/list is quite boring these
days :P

4) JVM safety net
- I don't think anyone can claim I can't do X in Clojure

Many important items and insightful observations have been discussed
in this thread which I totally agree need to be pursued with due
vigor. To my mind however Clojure is ready and the most important
priority is to hand out the party poppers and novelty hats. Well done
Rich and core contributors, I hope you choose to stamp 1.0 sooner than
later [obviously when you feel comfortable with that] :)


Regards,
Tim.


--~--~-~--~~~---~--~~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: The Path to 1.0

2009-04-18 Thread John Newman
Well, perhaps if str-utils becomes the universal standard for string
operations, it would be rolled into Clojure come 2.0?

On Sat, Apr 18, 2009 at 2:58 PM, Konrad Hinsen konrad.hin...@laposte.netwrote:


 On 18.04.2009, at 12:15, John Newman wrote:

  2) One way to maintain Clojure's flexibility would be if it were
  like what the kernel is to a Linux distribution.  What if every
  distribution had to use the same standard set of packages?  The
  Linux ecosystem is much richer today because the kernel can develop
  somewhat independently of the applications that target it.

 True, but there is still a standard set of packages (or rather
 functionalities) that all but the most specialized Linux
 distributions contain and that everybody expects to find in a
 normal Linux distribution. Things like the shell, ls, rm, etc.

  One way to compensate for a lack of batteries included might be a
  powerful, agnostic library management solution, which allows for
  different contrib libraries, VMs, or architectures, but that
  definitely seems like a 2.0 feature.

 That sounds like a lot of work, and it won't take care of one
 important contribution of a standard library: standardization for
 basic, well-understood tasks. It's no fun to program in an
 environment where there are three competing libraries for parsing
 HTML that differ only in function names and parameter order.

 Konrad.


 



-- 
John

--~--~-~--~~~---~--~~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Problem using clojure.contrib.seq-utils

2009-04-18 Thread Meikel Brandmeyer

Hi,

Am 18.04.2009 um 12:17 schrieb synphonix:

java.lang.NoSuchMethodError: clojure.lang.MultiFn.init(Lclojure/ 
lang/

IFn;Ljava/lang/Object;Lclojure/lang/IRef;)V(NO_SOURCE_FILE:0)
later invocations result in
java.lang.NoClassDefFoundError: Could not initialize class
clojure.contrib.seq_utils__init (NO_SOURCE_FILE:0)

Has someone seen similar problems and fixed them?


Ant cleaning your clojure-contrib build and recompiling
everything should fix your problem.

Sincerely
Meikel



smime.p7s
Description: S/MIME cryptographic signature


Re: The Path to 1.0

2009-04-18 Thread John Newman
 I do not agree with John Newman that the Java standard library
 should be the Clojure standard library.


I'm not saying that.  I'm saying that:

1) Requiring Java's standard library on every system is unfortunate enough
-- it's too big for some of the smaller devices coming out now. And,

2) One way to maintain Clojure's flexibility would be if it were like what
the kernel is to a Linux distribution.  What if every distribution had to
use the same standard set of packages?  The Linux ecosystem is much richer
today because the kernel can develop somewhat independently of the
applications that target it.

Eventually, clojure-contrib will be much much larger than clojure the
language.  If clojure-contrib is Clojure's standard, most of the work
involved in developing Clojure 2.0 won't be in core but in hammering on
contrib.  If that's what people want then great. It just seems like a less
flexible solution to me.

One way to compensate for a lack of batteries included might be a
powerful, agnostic library management solution, which allows for different
contrib libraries, VMs, or architectures, but that definitely seems like a
2.0 feature.

On Sat, Apr 18, 2009 at 1:51 AM, Tom Faulhaber tomfaulha...@gmail.comwrote:


 Tom's 2 cents:

 I think Clojure is basically ready to go to 1.0. I like the idea of
 having a book about Clojure 1.0 go hand in hand with the release.

 While I agree that the library management problem is too hard for a
 1.0 release (and also largely separable), it would be nice to see the
 software version number (e.g. 1.0.0) and the subversion number (e.g.
 r1352) in the built clojure.jar somewhere that's easily accessible to
 tools that are trying to do library management. My solution to this
 would probably just be to generate a couple of (def *clojure-version-
 number* 1.0.0) things as part of the build. Do any Java/Maven heads
 have more sophisticated ideas that we should consider here? I've just
 started hacking on some svn manipulation stuff (and a little bit of
 jar manipulation) in the process of doing my contrib autodoc robot, so
 I'd be happy to help here too.

 While I agree that what is clojure.contrib? is a pretty big issue, I
 think we could leave it a little fuzzy for a while longer. One thing
 we should probably do is do a real comparison of how we stack up
 against python's batteries included model and see how we need to
 address that. (To my mind, the python library has always felt very ad
 hoc.) I do not agree with John Newman that the Java standard library
 should be the Clojure standard library. There's enough that's
 different in Clojure that I think we do want some of our own ways to
 approach things. I think there's also space for some great documents
 ( screencasts, etc.) that show how to leverage parts of the Java
 library to do cool things in Clojure. (Rich's demo of building swing
 apps in Clojure comes to mind.)

 I'd also like to see a little more focus on the perl/python/ruby
 equivalence from a newbie perspective. That is, more clarity around
 startup, script execution (including having an equivalent to python's
 if  __name__ == '__main__': construct), class path management, etc.
 I know that this is one area where being in the JVM ecosystem makes
 our life worse rather than better, but approaching Clojure is still a
 bit daunting compared to these other languages.

 You can count me among the git fanboys, but I can't get too worked up
 about moving off google code right now (and that would be necessary if
 we switched to git). (Aside to Matt Revelle: You can use git-svn on
 the client side (and I do) but that provides only a local solution, so
 it isn't a magic bullet.)

 Really, we all know that 1.0 means 1.0. Clojure will be much further
 along than most other languages at their 1.0 point, so I wouldn't
 stress over it too much.

 I think that might have been 6 cents worth :-).

 Tom


 



-- 
John

--~--~-~--~~~---~--~~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Problem using clojure.contrib.seq-utils

2009-04-18 Thread synphonix

Hi Meikel,

I did that already and it did not help. I also explictly unset my
CLASSPATH env in the shell from which I start ant (just to be sure)
and checked that the clojure.jar property in clojure-contrib's
build.xml is correct.
I do not see this behavior when I switch clojure to svn rev 1339.

Regards

Poul

Meikel Brandmeyer schrieb:
 Hi,

 Am 18.04.2009 um 12:17 schrieb synphonix:

  java.lang.NoSuchMethodError: clojure.lang.MultiFn.init(Lclojure/
  lang/
  IFn;Ljava/lang/Object;Lclojure/lang/IRef;)V(NO_SOURCE_FILE:0)
  later invocations result in
  java.lang.NoClassDefFoundError: Could not initialize class
  clojure.contrib.seq_utils__init (NO_SOURCE_FILE:0)
 
  Has someone seen similar problems and fixed them?

 Ant cleaning your clojure-contrib build and recompiling
 everything should fix your problem.

 Sincerely
 Meikel
--~--~-~--~~~---~--~~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



#(%) error in map

2009-04-18 Thread Michael Hunger

I tried to use an anonymous function in map but it didn't work.

user= (map #(%) '(1 2 3))
java.lang.ClassCastException: java.lang.Integer cannot be cast to 
clojure.lang.IFn

but with a normal anonymous function it works as expected:

user= (map (fn [x] x) '(1 2 3))
(1 2 3)

Thanks
Michael

P.S. As I'm quite fresh to FP and clojure - is there some place where one can 
show / upload code examples and get some 
hints / help for improving them?

--~--~-~--~~~---~--~~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: #(%) error in map

2009-04-18 Thread Laurent PETIT
Hello, what you want here is identity :

(map identity (list 1 2 3))

Regards,

-- 
Laurent

2009/4/18 Michael Hunger cloj...@jexp.de


 I tried to use an anonymous function in map but it didn't work.

 user= (map #(%) '(1 2 3))
 java.lang.ClassCastException: java.lang.Integer cannot be cast to
 clojure.lang.IFn

 but with a normal anonymous function it works as expected:

 user= (map (fn [x] x) '(1 2 3))
 (1 2 3)

 Thanks
 Michael

 P.S. As I'm quite fresh to FP and clojure - is there some place where one
 can show / upload code examples and get some
 hints / help for improving them?

 


--~--~-~--~~~---~--~~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: #(%) error in map

2009-04-18 Thread Michael Hunger

I think my misconception was not the missing identiy fun but rather that the 
first element in the list is the function 
that is evaluated.
so #(%) is trying to evaluate whatever % evaluates to, e.g. (1) and therefore 
there is the
java.lang.ClassCastException: java.lang.Integer cannot be cast to 
clojure.lang.IFn

that also happens with #((+ % 1))

But you're right, identity helps there as well.
#(identity (+ % 1)) works :)

Thanks

Michael

P.S.
What about the second question? Is there some place one can get feedback to 
functional code samples of a learner?


Am 18.04.2009 14:14 Uhr, schrieb Laurent PETIT:
 (map identity (list 1 2 3))


--~--~-~--~~~---~--~~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: The Path to 1.0

2009-04-18 Thread Isak Hansen

On Thu, Apr 16, 2009 at 6:53 PM, Rich Hickey richhic...@gmail.com wrote:

 Feedback welcome,


1. I'd like to see a road map of sorts; plans for where Clojure will
be going with the next couple of releases.

2. Clojure-contrib -cleanup
 - Move the clojure test suite to clojure itself
 - Move 'worthy' libraries from contrib to the standard library?
 - Make ClojureCLR and clojurescipt separate projects with their own
branches and so on.

3. I'd like to see the clojure source hooked up to some CI system,
along the lines of http://ci.rubyonrails.org/.


I know it's not a vote, but I use git as well.


 Rich

 


--~--~-~--~~~---~--~~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: #(%) error in map

2009-04-18 Thread Laurent PETIT
2009/4/18 Michael Hunger cloj...@jexp.de


 I tried to use an anonymous function in map but it didn't work.

 user= (map #(%) '(1 2 3))
 java.lang.ClassCastException: java.lang.Integer cannot be cast to
 clojure.lang.IFn

 but with a normal anonymous function it works as expected:

 user= (map (fn [x] x) '(1 2 3))
 (1 2 3)

 Thanks
 Michael

 P.S. As I'm quite fresh to FP and clojure - is there some place where one
 can show / upload code examples and get some
 hints / help for improving them?


I guess #clojure on IRC,

HTH,

-- 
Laurent



 


--~--~-~--~~~---~--~~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Help writing a lazy version of this Choose function.

2009-04-18 Thread CuppoJava

Hi,
I just wrote a very small combinatorics utility for myself. Choose. It
is given a vector of elements, followed by a number that indicates how
many elements to choose out of the vector. It returns all possible
combinations of choosing num elements out of v while retaining the
correct order.

I hit a snag though, I'm getting lots of OutOfMemory errors because of
the use of mapcat, which doesn't seem to be lazy. Can I have some help
writing this into a lazy function?

Thanks a lot
  -Patrick

(defn choose [v num]
  (if (zero? num)
  []
  (mapcat (fn [i]
  (let [n (nth v i)]
   (map #(conj % n) (choose (nthrest v (inc i))
(dec num)
  (range (count v)
--~--~-~--~~~---~--~~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Improving clojure.jar/clojure-contrib.jar compression (ClassLoader alternatives)

2009-04-18 Thread kevin

You can use java's pack200 tool to compress your jar down quite a bit:

http://java.sun.com/j2se/1.5.0/docs/tooldocs/share/pack200.html

I haven't tried it yet, but this ClassLoader that will decompress the
pack200 archive into a temp directory before loading the classes.

http://scala.sygneca.com/code/compressed-executable-jar

Kevin

On Apr 17, 7:37 pm, Stuart Sierra the.stuart.sie...@gmail.com wrote:
 On Apr 17, 7:36 pm, Dimiter \malkia\ Stanev mal...@gmail.com
 wrote:

  Is there any alternative (ClassLoader?) to store the .class files in a
  different compressed format?.NET can store lots of classes in one
  assembly? Is there something like that for JVM?

 ClassLoaders can do almost anything, including load classes via HTTP,
 so I expect it would be possible to write a custom ClassLoader that
 uses a different compression format (like tar.gz).  But it wouldn't
 necessarily be easy.  ZIP is convenient because it permits random
 access to any file within the archive, which tar does not.

 Here's an (old) article with a related 
 example:http://www.javaworld.com/javaworld/jw-04-2000/jw-0421-zipclass.html

 -Stuart Sierra
--~--~-~--~~~---~--~~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Standard startup script?

2009-04-18 Thread e
i wonder if others would think it'd be interesting to integrate clojure with
http://jamvm.sourceforge.net/

... maybe fork the project so that running a clj file feels exactly like
running a py file ... embed the jvm in an exe.

Maybe others like the fact that it works on top of any jvm, but I think it
increases the bar for getting non-java newbies.  Not everyone wants to have
to install a large jvm from sun and write start up scripts before they can
get started.
2009/4/17 e evier...@gmail.com

 it was kind of annoying, at first, to have to type up the startup script
 myself from the getting started wiki page (or cut-n-paste).  Seemed like
 it should have come with the download, but once I dedicated some time to it,
 it was ok.  Netbeans plugin, I think, was a good substitute when I just
 wanted to dive in, but then I didn't really get what was going on, per se.
 In the end, I now think it was good to walk through the getting started
 page.  It's like clojure comes as a kit car.  Then when you are driving
 it, you have a better chance of having some idea how to pop the hood and
 tinker.

 On the other hand, I don't think this would appeal to potential python
 converts who can install python, and five seconds later, and two lines of
 code learn how to write a script to untar/unzip a file.  In that particular
 case I think it was awesome that there was such an easy work-around to
 windows not coming with a way to untar/unzip out of the box.  Easier to
 install python and do it than any other solution, I found.  No admin rights
 needed, no separate jvm/jdk/IDE download, etc.

 2009/4/17 Mark Volkmann r.mark.volkm...@gmail.com


 On Thu, Apr 16, 2009 at 4:10 PM, Marko Kocić marko.ko...@gmail.com
 wrote:
 
  I have seen various scripts to start clojure in the net. Everyone
  seems to have its favourite, even contrib has one. Also, there are a
  lot of questions what is the bestest way to invoke clojure, how to
  start REPL, how to run script, compile file, should it be used with
  server or client VM.
 
  Do you think it would be benefitial to have such script included as
  part of standard clojure?

 I think this would be beneficial, especially for beginners.

 --
 R. Mark Volkmann
 Object Computing, Inc.

 



--~--~-~--~~~---~--~~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Problem using clojure.contrib.seq-utils

2009-04-18 Thread Michael Wood

I was having trouble building clojure-contrib after having updated
both clojure and clojure-contrib.  Clojure was already at HEAD.

I have a habit of running ant clean before compiling.

When I tried to build clojure-contrib, I was getting a stack trace,
which was complaining about get-method.  I tried reverting the last
checkin to clojure-contrib and that appeared to fix it.  Then I tried
compiling the latest revisions of clojure and clojure-contrib on
another machine (using Java 1.5 vs. 1.6 on the machine I was having a
problem on) and it worked.

So I updated to the latest revision of clojure-contrib again, then got
rid of anything reported by svn st --no-ignore as ignored or unknown
and rebuilt clojure and then clojure-contrib.

Now it's working.  Not sure what was causing the problem, but making
sure the working copies were clean fixed it.

-- 
Michael Wood mw...@bluebird.co.za

--~--~-~--~~~---~--~~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: #(%) error in map

2009-04-18 Thread Michael Wood

On Sat, Apr 18, 2009 at 2:52 AM, Michael Hunger cloj...@jexp.de wrote:

 I tried to use an anonymous function in map but it didn't work.

 user= (map #(%) '(1 2 3))
 java.lang.ClassCastException: java.lang.Integer cannot be cast to 
 clojure.lang.IFn

 but with a normal anonymous function it works as expected:

Others have already explained why this happens.

If you really want to do something like that, then you can use do to
get rid of the effect of the implicit parentheses:

(map #(do %) '(1 2 3))

Also, since Clojure has first class vectors, you may as well use them
instead of having to quote your literal lists:

(map identity [1 2 3])

[...]
 P.S. As I'm quite fresh to FP and clojure - is there some place where one can 
 show / upload code examples and get some
 hints / help for improving them?

If you don't want to ask here, you could try http://www.lispforum.com/

Although I think there are more Common Lisp people there than Clojure
people, they are quite helpful with newbie Common Lisp questions :)  I
don't think anyone's posted a Clojure code question there yet.

-- 
Michael Wood esiot...@gmail.com

--~--~-~--~~~---~--~~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Updated clojure-pom (now even simpler to use with emacs)

2009-04-18 Thread dysinger

http://github.com/dysinger/clojure-pom/tree/master

I found a way to unpack dependencies and added a function (see README)
for emacs that sets up the classpath for a maven/clojure project.
strongThis way you can add dependencies with maven and not have to
restart your slime session./strong.

Since maven  slime can handle setting up the dependency/classpaths
now, there is no longer a need to generate a repl script (so the poms
are even shorter).

In emacs you can now type:

M-x clj-mvn-project /The/Path/To/Mah/Awesome/Sauce/Project
M-x slime

and emacs will do it's thing, starting a slime session with all the
right things in place.

-Tim

--~--~-~--~~~---~--~~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Updated clojure-pom (now even simpler to use with emacs)

2009-04-18 Thread dysinger

Sorry that is clj-mvn-proj not clj-mvn-project

On Apr 18, 9:12 am, dysinger dysin...@gmail.com wrote:
 http://github.com/dysinger/clojure-pom/tree/master

 I found a way to unpack dependencies and added a function (see README)
 for emacs that sets up the classpath for a maven/clojure project.
 strongThis way you can add dependencies with maven and not have to
 restart your slime session./strong.

 Since maven  slime can handle setting up the dependency/classpaths
 now, there is no longer a need to generate a repl script (so the poms
 are even shorter).

 In emacs you can now type:

 M-x clj-mvn-project /The/Path/To/Mah/Awesome/Sauce/Project
 M-x slime

 and emacs will do it's thing, starting a slime session with all the
 right things in place.

 -Tim
--~--~-~--~~~---~--~~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



On Stuart's Book

2009-04-18 Thread George Jahad

Hey StuartH:

I finally got around to buying your book yesterday.  The thing that
finally sold me was Rich's email about how important your book was.
Without that, I wouldn't have considered paying for it, with so much
other clojure material available on the web.

I think it would be a good idea for you to prominently display this
paragraph from Rich's forward on the book's web page:

What is so thrilling about Stuarts book is the extent to which he gets
Clojure, because the language is targeted to professional developers
just like himself. He clearly has enough experience of the pain points
Clojure addresses, as well as an appreciation of its pragmatic
approach.
This book is an enthusiastic tour of the key features of Clojure, well
grounded in practical applications, with gentle introductions to what
might be new concepts. I hope it inspires you to write software in
Clojure
that you can look back at and say âNot only does this do the job,
but it does so in a robust and simple way, and writing it was fun too!
Rich Hickey
Creator of Clojure

I'll start reading it in the next few days and let you know what I
think.

George Jahad

--~--~-~--~~~---~--~~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: On Stuart's Book

2009-04-18 Thread Rayne

So you want him to write something that Rich hasn't said on his
website to market his book? :\ If not you're going to clarify a bit.

I wish Stuart would have open sourced the book, like Real World
Haskell did. Would have done all kinds of good for the language. But
each to his own and Stuart rocks for even writing the book. :D

On Apr 18, 1:02 pm, George Jahad andr...@blackbirdsystems.net wrote:
 Hey StuartH:

 I finally got around to buying your book yesterday.  The thing that
 finally sold me was Rich's email about how important your book was.
 Without that, I wouldn't have considered paying for it, with so much
 other clojure material available on the web.

 I think it would be a good idea for you to prominently display this
 paragraph from Rich's forward on the book's web page:

 What is so thrilling about Stuarts book is the extent to which he gets
 Clojure, because the language is targeted to professional developers
 just like himself. He clearly has enough experience of the pain points
 Clojure addresses, as well as an appreciation of its pragmatic
 approach.
 This book is an enthusiastic tour of the key features of Clojure, well
 grounded in practical applications, with gentle introductions to what
 might be new concepts. I hope it inspires you to write software in
 Clojure
 that you can look back at and say âNot only does this do the job,
 but it does so in a robust and simple way, and writing it was fun too!
 Rich Hickey
 Creator of Clojure

 I'll start reading it in the next few days and let you know what I
 think.

 George Jahad
--~--~-~--~~~---~--~~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: The Path to 1.0

2009-04-18 Thread Antony Blakey


On 18/04/2009, at 5:38 PM, Konrad Hinsen wrote:


 On 18.04.2009, at 01:13, Dan wrote:

 do you prefer to have some clojure users united against subversion,
 or divided by Rich not having chosen their preferred DVCS
 (Mercurial users vs Git users, not sure whether clojure needs those
 kinds of nonsense internal wars in the community )

 We seem to be unanimous in preferring git.

 Not at all. I am a convinced Mercurial user, for example, and I don't
 even have git installed on my machine (I do have svn). However, I
 didn't participate in this debate because I think it is pointless.
 VCS issues are as much a matter of personal preference as technical
 merit. It's Rich who does all of the commits, so it's for him to  
 choose.

That's not the case for contrib.

If Rich is the only committer *and contributor* to core, then it's a  
moot point what VCS is used for core.

Antony Blakey
-
CTO, Linkuistics Pty Ltd
Ph: 0438 840 787

A Buddhist walks up to a hot-dog stand and says, Make me one with  
everything. He then pays the vendor and asks for change. The vendor  
says, Change comes from within.




--~--~-~--~~~---~--~~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: On Stuart's Book

2009-04-18 Thread Antony Blakey


On 19/04/2009, at 8:08 AM, Rayne wrote:


 So you want him to write something that Rich hasn't said on his
 website to market his book? :\

But Rich has written that - it's from Rich's forward to Stuart's book.  
Am I misunderstanding your point?

Antony Blakey
-
CTO, Linkuistics Pty Ltd
Ph: 0438 840 787

Nothing is really work unless you would rather be doing something else.
   -- J. M. Barre



--~--~-~--~~~---~--~~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Help writing a lazy version of this Choose function.

2009-04-18 Thread Laurent PETIT
Hello,

It seems that the recursive call to choose is too eager.

I had a problem with your version (which seems to be using a pre lazy-seq
version) where nthrest still existed (?).

But I rewrote something along the lines of what you did, and had first the
same problem.
Wrapping the recursive call with lazy-seq seemed to solve it.

Here is my final (apparently) working version :

(defn rests [coll]
  returns a lazy seq of coll, (rest coll), (rest (rest coll)) ...
  (lazy-seq
(when-let  [s (seq coll)]
  (cons s (rests (rest s))

(defn choose [v n]
  (cond
(zero? n)
  []
(= 1 n)
  (map vector v)
:else
  (mapcat (fn [sub]
(map #(concat [(first sub)] %)
 (lazy-seq (choose (rest sub) (dec n)
  (rests v
(count (choose [1 2 3 4 5 6] 3))
(take 10 (choose (iterate inc 0) 500))

HTH,

-- 
Laurent

--~--~-~--~~~---~--~~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: On Stuart's Book

2009-04-18 Thread Michael Wood

On Sun, Apr 19, 2009 at 1:30 AM, Antony Blakey antony.bla...@gmail.com wrote:

 On 19/04/2009, at 8:08 AM, Rayne wrote:


 So you want him to write something that Rich hasn't said on his
 website to market his book? :\

 But Rich has written that - it's from Rich's forward to Stuart's book.
 Am I misunderstanding your point?

I suspect he misread the message.  It may (or may not) have helped if
it had been spelt foreword instead of forward, though.

-- 
Michael Wood esiot...@gmail.com

--~--~-~--~~~---~--~~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Help writing a lazy version of this Choose function.

2009-04-18 Thread CuppoJava

Wow, that works great. Thanks a lot for your help Laurent.

Can you think of any reason why mapcat isn't lazy by default though?
I'm wondering if this is by design, or simply because we haven't had
the time to update all the library functions to be fully lazy yet.

  -Patrick
--~--~-~--~~~---~--~~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Monad mod

2009-04-18 Thread jim

Konrad,

Love your monad library, but somethings always bothered me. The monad
functions like m-seq, m-lift, etc. were macros so they couldn't be
applied, passed as parameters. I'm impressed you were able to
implement them using macros.

While working on an unrelated thing, I had a flash of inspiration and
implemented with-monad as below. This makes all those functions actual
function objects. What do you think?

Jim

http://groups.google.com/group/clojure/web/with-monad.clj
--~--~-~--~~~---~--~~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Help Improving Game Of Life in clojure

2009-04-18 Thread Michael Hunger

As I'm currently trying to learn clojure I wrote a game of life to get a 
feeling for the concepts.
It would be great if some of you could point out areas for improvement or 
unused idioms or patterns.

Thanks alot

Michael

here is the code:
(ns gol)
(comment a board only contains the coordinates of living cells)

(def matrix #{[-1 -1] [-1 0] [-1 1] [0 -1] [0 0] [0 1] [1 -1] [1 0] [1 1]})

(def size 3)

(defn neighbours
   All direct neighbours around [pos] and pos itself
   [pos]
   (defn translate [[x y]] [(+ x (first pos)) (+ y (second pos))])
   (map translate matrix)
)

(defn alive
   is pos alive in the next turn
   [pos board]
   (defn count-living [cnt p] (if (contains? board p) (inc cnt) cnt))
   (defn gets-a-life [living-neighbours]
 (or (and (not (contains? board pos)) (= living-neighbours 3))
(and (contains? board pos) (contains? #{3 4} living-neighbours)))
 )
   (gets-a-life (reduce count-living 0 (neighbours pos)))
   )

(defn all-neighbours
 all direct neighbours of all living cells on the board
  [size board]
  (defn on-board [[x y]] (and (= x 0) ( x size) (= y 0) ( y size)))
  (set (filter on-board (mapcat #(neighbours %) board)))
)

(defn next-board
   calculates the new board
   ([board] (next-board size board))
   ([bsize board]
  (let [
new-board (map
   (fn [[x y]] (if (alive [x y] board) [x y] nil))
   (all-neighbours bsize board))
]
 (set (filter #(not (nil? %)) new-board
   )

(defn to-string
 creates a string representation of a board
 ([board] (to-string size board))
 ([bsize board]
   (def axis (range bsize))
   (reduce
(fn [text x]
(str text (reduce
(fn [text y]
(str text (if (contains? board [x y]) # _))
)
 axis)
 \n))  axis)))

(defn time-it
 calculates a board of a certain size n times and prints the time
 [cnt size board]
   (time (loop [x cnt
   b board]
   (if (zero? x) (to-string b)
   (recur (dec x) (next-board size b)
)

(def start-board #{[0 0] [1 1] [0 1] [2 2]})

(defn demo
runs a simple board 10 times
[]
(map
  #(println (to-string %))
  (take 10 (iterate next-board start-board))
))


(defn next-board-old
 old version that evaluated the whole board
 ([board] (next-board size board))
 ([bsize board]
   (let [
   axis (range bsize)
   new-board (map (fn [x] (map (fn [y] (if (alive [x y] board) [x y] nil)) 
axis)) axis)
   ]
   (set (filter #(not (nil? %)) (mapcat (fn [x] x) new-board
   )
)


--~--~-~--~~~---~--~~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



IFn?

2009-04-18 Thread tmountain

Sorry for the newbie question, but can someone tell me what IFn means
exactly? I keep running into it in the docs particularly in the
keyword documentation, and Google has yet to expain.

Thanks,
Travis
--~--~-~--~~~---~--~~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: IFn?

2009-04-18 Thread Kevin Downey

ifn? returns true for things that implement clojure.lang.IFn, IFn is
the interface for things that can be put in the operator position in a
s-expr:
functions
vectors
maps
sets
keywords
symbols
...?

fn? returns true for just functions

On Sat, Apr 18, 2009 at 9:37 PM, tmountain tinymount...@gmail.com wrote:

 Sorry for the newbie question, but can someone tell me what IFn means
 exactly? I keep running into it in the docs particularly in the
 keyword documentation, and Google has yet to expain.

 Thanks,
 Travis
 




-- 
And what is good, Phaedrus,
And what is not good—
Need we ask anyone to tell us these things?

--~--~-~--~~~---~--~~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: The Path to 1.0

2009-04-18 Thread Tom Faulhaber



On Apr 18, 3:15 am, John Newman john...@gmail.com wrote:
  I do not agree with John Newman that the Java standard library
  should be the Clojure standard library.

 I'm not saying that.  I'm saying that:


John, I misunderstood what you were trying to say. My apologies!

There seems to be some agreement that the current contrib is not well-
defined and probably not the best long-term solution. I don't think
that it was meant to be. Most of us seem to agree that, while this is
important, it shouldn't stop us for going to 1.0. At the same time, we
should continue working this issue as a community.
--~--~-~--~~~---~--~~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---