Re: German Clojure Book

2010-03-11 Thread Garth Sheldon-Coulson
I agree that the cover is really beautiful. Let us know when your daughter has pieces on exhibit =). Good luck with the writing! On Thu, Mar 11, 2010 at 8:08 PM, Angel Java Lopez wrote: > Great! > > I thought the cover was a Bratko, as in other Lisp book > > Angel "Java" Lopez > http://www.aj

Another `line-seq' issue

2010-03-11 Thread Mark Triggs
Hi all, At the risk of being labelled "the guy who always whines about line-seq", I'm whining about line-seq again. I hit some surprising behaviour stemming from the fact that line-seq isn't fully lazy: (defn line-seq "Returns the lines of text from rdr as a lazy sequence of strings. r

Re: "Interesting" integer behavior

2010-03-11 Thread Mark Engelberg
If (inc 21471493647) and (+ 1 21471493647) produce different types of numbers, I would definitely categorize this as a "bug" and not just "strange behavior". This means that if you use 2147493748 as a key in a map or set it might work improperly depending on what computation you used to arrive at

Re: German Clojure Book

2010-03-11 Thread Angel Java Lopez
Great! I thought the cover was a Bratko, as in other Lisp book Angel "Java" Lopez http://www.ajlopez.com http://twitter.com/ajlopez On Thu, Mar 11, 2010 at 7:27 PM, Stefan Kamphausen wrote: > Hi, > > > Congratulations! I hope there will be an English translation one day. > > probably not.

Re: jogl classpath not found

2010-03-11 Thread strattonbrazil
Hrmm, that's weird. Well thanks for that. I just put it all on the command line for now. Does -jar ignore -cp or something because that didn't work for me? This is what I got now... java -cp ~/clojure/clojure-1.0.0.jar:./jogl-2.0-linux-amd64/lib/ jogl.all.jar:./jogl-2.0-linux-amd64/lib/gluegen

Re: quote versus backquote

2010-03-11 Thread Richard Newman
Is there a good reason for this behavior? What is the rationale behind it? Read this. http://clojure.org/reader#syntax-quote -- 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 Note that pos

quote versus backquote

2010-03-11 Thread Felix Breuer
Hello! I just noticed that quote constructs different lists than backquote. We have user> (= `(v 3) `(v ~(+ 1 2))) true but user> (= '(v 3) `(v ~(+ 1 2))) false user> (= '(v 3) `(v 3)) false and user> (= '(v 3) (list 'v 3)) true user> (= `(v 3) (list `v 3)) true user> (= '(v 3) (list `v 3)) f

Re: German Clojure Book

2010-03-11 Thread faenvie
> You don't know how proud you made me with that remark! It was painted > in 2008 by my daughter who at that time was 5 years old.  The original > is approx 1m in height.  Thank you very much, indeed! gute idee ... i like this cover too now ,-) -- You received this message because you are subsc

Re: jogl classpath not found

2010-03-11 Thread Zach Tellman
In the past, I haven't had a lot of luck putting the JOGL libraries on the classpath. A much better approach, I've found, is to create a custom script to load up clojure, and put the class and library paths as parameters to the java executable. My library used to target JOGL (it now uses LWJGL),

Re: jogl classpath not found

2010-03-11 Thread Richard Lyman
I'm not sure if this will help, but here's some tidbits from the day I spent toying around with JOGL... I think it was version 1.1.1. This is part of the Ant file that I used: ...

Re: Rebinding vars at compile time

2010-03-11 Thread Benjamin Teuber
> > (def *assert* false) > > You cannot use def to change the value of a var in another namespace.   > This is nothing specific to *assert* or to clojure.core. > Here is what you can do instead: > >         (alter-var-root (var *assert*) (fn [_] false)) I actually tried from inside clojure.core,

Re: German Clojure Book

2010-03-11 Thread Stefan Kamphausen
Hi, > Congratulations! I hope there will be an English translation one day. probably not. There is good English material available and even better coming up. I don't see how I could produce something better than Chouser or Stu. > The book cover is awesome; really like the design and the main f

jogl classpath not found

2010-03-11 Thread strattonbrazil
I downloaded the new jogl 2.0 libs and can't get jogl to be recognized in my classpath. It's stuck on the import. (import '(javax.media.opengl.awt GLCanvas)) In my shell I have clojure aliased to 'java -jar clojure-1.0.0.jar' I have my CLASSPATH as echo $CLASSPATH ./jogl-2.0-linux-amd64/lib/jo

Re: [ANN] German Clojure Book

2010-03-11 Thread Baishampayan Ghose
Stefan Kamphausen wrote: Fellow Clojurians, please let me announce the writing of another book on Clojure, this time in German. So, if you're familiar with that language you might want to read the tiny webpage at http://www.clojure-buch.de where I'll announce whatever little news I may have, or

[ANN] German Clojure Book

2010-03-11 Thread Stefan Kamphausen
Fellow Clojurians, please let me announce the writing of another book on Clojure, this time in German. So, if you're familiar with that language you might want to read the tiny webpage at http://www.clojure-buch.de where I'll announce whatever little news I may have, or the publisher's page at ht

Re: Leiningen, Clojure and libraries: what am I missing?

2010-03-11 Thread Phil Hagelberg
On Wed, Mar 10, 2010 at 10:24 PM, Meikel Brandmeyer wrote: > On Mar 11, 5:07 am, Brent Millare wrote: >> Since leiningen downloads everything to a local repo, can't we do away >> with copies and use symlinks if they are supported by the filesystem? >> I feel there should be an option for this. > >

Re: using counterclockwise with 1.2 snapshots?

2010-03-11 Thread Laurent PETIT
Hi Stuart, 2010/3/11 Stuart Halloway : > What is the preferred way of using counterclockwise with 1.2 snapshots. Here > is how I retrofitted an existing project: > > (1) Create a Clojure project on top of the exiting source dir Yes. > (2) Under "Run Configurations" add user entries for lib/**.ja

NYC Clojure Users Group - need someone to do a brief tutorial for our next meetup

2010-03-11 Thread Eric Thorsen
I thought it would be good to start the next meeting with a brief introduction to any aspect of Clojure and was hoping someone might volunteer to do that for us. It does not need to be any more that 20-30 minutes (although you can take more time if you like). Please contact me if you can help. Th

Re: (seq? x) vr.s (not (empty? x))

2010-03-11 Thread Alex Osborne
Brian Hurt writes: > I will note that vec and set both behave differently- when handed an empty > sequence they don't return nil, they return the (not nil) empty vector or set > (respectively).  The specific behavior of seq being depended upon in this case > is different between seq and other, si

Re: using counterclockwise with 1.2 snapshots?

2010-03-11 Thread Luc Préfontaine
Hi Stuart, we do exactly the same thing here. We want to insure that we always use the same Clojure/Contrib run times as we have currently in production. Luc On Thu, 2010-03-11 at 12:18 -0500, Stuart Halloway wrote: > What is the preferred way of using counterclockwise with 1.2 > snapshots.

Re: (seq? x) vr.s (not (empty? x))

2010-03-11 Thread Michał Marczyk
On 11 March 2010 21:26, Brian Hurt wrote: > I think I still disagree with this idiom, for two reasons.  First, I have > the hope that some day Clojure will be smart enough to realize that the > boolean returned from empty? can be unboxed, and unbox it (with all the > performance optimizations this

Re: (seq? x) vr.s (not (empty? x))

2010-03-11 Thread Kevin Downey
given that rhickey wrote seq, and rhickey recommends using it for this purpose, I doubt you need to worry about it changing radically without warning. the behavior of seq is not just incidental, it has a history stretching back to before seqs became as lazy as they are now, and it's behavior made i

Re: (seq? x) vr.s (not (empty? x))

2010-03-11 Thread Brian Hurt
On Thu, Mar 11, 2010 at 3:40 PM, Kevin Downey wrote: > it's not a corner case, seq returns a seq containing more items if > there are more, or nil if there are not. have you looked at clojure's > truth table? if distinguishes from nil and not-nil, with true and > false thrown in for interop. > >

Re: (seq? x) vr.s (not (empty? x))

2010-03-11 Thread Kevin Downey
it's not a corner case, seq returns a seq containing more items if there are more, or nil if there are not. have you looked at clojure's truth table? if distinguishes from nil and not-nil, with true and false thrown in for interop. On Thu, Mar 11, 2010 at 12:26 PM, Brian Hurt wrote: > > > On Thu,

Re: (seq? x) vr.s (not (empty? x))

2010-03-11 Thread Brian Hurt
On Thu, Mar 11, 2010 at 2:36 PM, Chouser wrote: > On Thu, Mar 11, 2010 at 2:19 PM, Brian Hurt wrote: > > So the doc comment on empty? reads, in part: > > > >> Please use the idiom (seq x) rather than (not (empty? x)) > > > > A heads up to people: these two code sequences are *not* identical in >

Re: (seq? x) vr.s (not (empty? x))

2010-03-11 Thread Michał Marczyk
On 11 March 2010 20:36, Brian Hurt wrote: > On Thu, Mar 11, 2010 at 2:33 PM, Kevin Downey wrote: >> seq is not seq? > No- it's just that empty lists are still seqs (seq? returns true). > > The only thing that is wrong here is the doc comment for empty?- it makes > sense (to me at least) that empt

Re: (seq? x) vr.s (not (empty? x))

2010-03-11 Thread Kevin Downey
who said they are? On Thu, Mar 11, 2010 at 11:36 AM, Brian Hurt wrote: > > > On Thu, Mar 11, 2010 at 2:33 PM, Kevin Downey wrote: >> >> seq is not seq? >> > > No- it's just that empty lists are still seqs (seq? returns true). > > The only thing that is wrong here is the doc comment for empty?- i

Re: (seq? x) vr.s (not (empty? x))

2010-03-11 Thread Brian Hurt
On Thu, Mar 11, 2010 at 2:33 PM, Kevin Downey wrote: > seq is not seq? > > No- it's just that empty lists are still seqs (seq? returns true). The only thing that is wrong here is the doc comment for empty?- it makes sense (to me at least) that empty lists are seqs, just like non-empty lists are.

Re: (seq? x) vr.s (not (empty? x))

2010-03-11 Thread Chouser
On Thu, Mar 11, 2010 at 2:19 PM, Brian Hurt wrote: > So the doc comment on empty? reads, in part: > >> Please use the idiom (seq x) rather than (not (empty? x)) > > A heads up to people: these two code sequences are *not* identical in > behavior: > > user=> (seq? '()) > true > user=> (not (empty?

Re: (seq? x) vr.s (not (empty? x))

2010-03-11 Thread Kevin Downey
seq is not seq? On Thu, Mar 11, 2010 at 11:19 AM, Brian Hurt wrote: > So the doc comment on empty? reads, in part: > >> Please use the idiom (seq x) rather than (not (empty? x)) > > A heads up to people: these two code sequences are *not* identical in > behavior: > > user=> (seq? '()) > true > us

Re: Montreal Clojure User Group

2010-03-11 Thread Phil Hagelberg
On Thu, Mar 11, 2010 at 8:18 AM, Dan wrote: > We now have a Montreal Clojure User Group which we unanimously voted > to call Bonjure. It's URL is http://www.bonjure.org and it would be > nice if it was added to the list of communities on Clojure's website. > And if we could get more people from Mo

(seq? x) vr.s (not (empty? x))

2010-03-11 Thread Brian Hurt
So the doc comment on empty? reads, in part: Please use the idiom (seq x) rather than (not (empty? x)) > A heads up to people: these two code sequences are *not* identical in behavior: user=> (seq? '()) true user=> (not (empty? '())) false user=> Brian -- You received this message because you

Re: collections within collections

2010-03-11 Thread Christophe Grand
Hi all, Since I'm fp-phobic when doing arithmetic :-) here is mine: (defn pythagorean-triples [] (for [a (iterate inc 1) :let [squares (into {} (for [c (range a (* 1.5 a))] [(* c c) c]))] b (range 1 a) :let [c (squares (+ (* a a) (* b b)))] :when c] [a b c])) Ch

Re: collections within collections

2010-03-11 Thread Wilson MacGyver
if you use (map f coll), with only 1 collection. it takes every item in the collection, and apply f to it. so what I'm really doing is, taking "1 item" at a time from the collection. but "1 item" turns out to be a collection. I then apply a filter to it so it only returns what I want. On Thu, Mar

Re: collections within collections

2010-03-11 Thread Tyler Perkins
I'm afraid additional verbosity is required. But thanks to your excellent book (page 229), I know how to import sqrt and floor: (use '[clojure.contrib.import-static :only (import-static)]) (import-static java.lang.Math sqrt floor) ;;; ... your Clojure code ... -- You received this message becau

using counterclockwise with 1.2 snapshots?

2010-03-11 Thread Stuart Halloway
What is the preferred way of using counterclockwise with 1.2 snapshots. Here is how I retrofitted an existing project: (1) Create a Clojure project on top of the exiting source dir (2) Under "Run Configurations" add user entries for lib/**.jar, ahead of the 1.1 bits installed by the project w

Re: collections within collections

2010-03-11 Thread Glen Rubin
it seems kind of weird that map would work like that. i understood map as taking the first item of every collection and applying f to it. e.g (map + [2 4] [6 8]) -> [8 12] In this case, since answer? takes a collection as argument I guess map just applies answer? to each collection? but don't

Montreal Clojure User Group

2010-03-11 Thread Dan
We now have a Montreal Clojure User Group which we unanimously voted to call Bonjure. It's URL is http://www.bonjure.org and it would be nice if it was added to the list of communities on Clojure's website. And if we could get more people from Montreal to join obviously :) -- You received this me

Re: Software Training Center and Startup Incubator

2010-03-11 Thread startup
I presume you are referring to the lack of UI widgets, I would indent targeting the Google App stack using Google GWT widget libraries to cut out browser compatibility issues etc. And hopefully drive the development from withing Clojure Emacs. Similar to http://www.hackers-with-attitude.com/ On Ma

Something similar to (match) from scheme?

2010-03-11 Thread Luka
Is there a way to do pattern matching on values in clojure similar to this: http://docs.plt-scheme.org/reference/match.html What I'm trying to do is simple lexing/parsing: I would match parts of strings with regexp, and then do a parsing with match form. What is the best way of doing this in cl

Re: Two potential map-util functions

2010-03-11 Thread Luka
Thanks everyone for answers! -- 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from th

Re: collections within collections

2010-03-11 Thread Stuart Halloway
The same strategy works in Clojure, of course: (defn b-of-a [a] (/ (* 1000.0 (- 500.0 a)) (- 1000.0 a))) (defn near-int? [x] (< (- x (floor x)) 0.1)) (first (for [a (iterate inc 1) :let [b (b-of-a a)] :when (near-int? b)] [a b (sqrt (+ (* a a) (* b b)))])) Stu I like Clojure, but

Re: Leiningen, Clojure and libraries: what am I missing?

2010-03-11 Thread Laurent PETIT
Hello, 2010/3/11 Per Vognsen : > The way to go is definitely symlinks or hard links, not classpath > hijinks. Why so ? If you use 'mvn repl' or 'lein repl' to start your repl, why not just let mvn / lein manage the dependencies from beginning to end ? > The only problem is that Java's filesyste

Re: Software Training Center and Startup Incubator

2010-03-11 Thread Saul Hazledine
On Mar 10, 10:37 pm, startup wrote: > The software center would try to steer the candidates to use Lisp/ > Clojure over other languages because of the flexibility and speed with > with ideas can be developed and the languages inherent suitability for > large Web Scale/Cloud apps and AI. > I've st

Re: Leiningen, Clojure and libraries: what am I missing?

2010-03-11 Thread Per Vognsen
If you use a DVCS like Mercury or Bazaar that mainly uses clone-style branching then it can become significant. The jars are build artifacts and so ignored by the repository and not subject to the DCVS's hard-link-based sharing. Penumbra is a small project and it already has 12 megabytes of jars in

Re: Leiningen, Clojure and libraries: what am I missing?

2010-03-11 Thread Per Vognsen
Instead of symlinks you can use hard links like every decent DVCS does for clone-style branches. Hard links are supported on NTFS, HFS, and all the Unix file systems on wide use. They are transparent to users of the file system, so you can easily make tarballs of hardlinked jars, etc, without any p

Re: Leiningen, Clojure and libraries: what am I missing?

2010-03-11 Thread Per Vognsen
The way to go is definitely symlinks or hard links, not classpath hijinks. The only problem is that Java's filesystem API has no support for links, so you'll probably need to use OS-specific command line calls. Not too bad though. -Per On Thu, Mar 11, 2010 at 11:07 AM, Brent Millare wrote: > Sin

Re: "Interesting" integer behavior

2010-03-11 Thread Stuart Campbell
I took a look at the code for Clojure 1.1, in clojure.lang.Numbers, and it seems that results of numerical ops on BigIntegers (BigIntegerOps) are passed to a 'reduce' method, which appears to return the most economical representation of a number: static public Number reduce(BigInteger val)

Re: "Interesting" integer behavior

2010-03-11 Thread Jürgen Hötzel
Hi, 2010/3/10 Brian Hurt : > In a recent clojure: > > user=> (class 2147483647) > java.lang.Integer > user=> (class (inc 2147483647)) > java.math.BigInteger upcasted to BigInteger because of overflow detection in IntegerOps, even though a cast to Long would be sufficient. Also odd because of: us

Re: Leiningen, Clojure and libraries: what am I missing?

2010-03-11 Thread Alex Osborne
Richard Newman writes: > Whatever happened to engineers building a decent solution out of a > sense of pride, or even making the most basic half-assed attempt to > conserve resources? I take your points but I think we may just have different priorities of what to conserve, so we could probably a