Re: how to learn clojure ?

2009-02-18 Thread Paul Barry
I agree with this. Clojure is significantly different than Common Lisp and Scheme, so reading On Lisp and Practical Common Lisp are going to cover a bunch of stuff not relevant to Clojure. The Prag Prog book, Programming Clojure, covers pretty much everything you need to know about Lisp, at least

Re: Got a Clojure user group?

2009-04-11 Thread Paul Barry
Washington DC Clojure Study Group http://groups.google.com/group/clojure-study-dc On Thu, Apr 9, 2009 at 3:00 PM, Rich Hickey wrote: > > Got a Clojure user group, meetup etc? > > Reply to this message and let me know, I'll add them to the Clojure > site. > > Please supply a primary URL for gett

Re: PeepCode screencast

2009-04-27 Thread Paul Barry
Yeah, I agree that it was pretty good. I like that you have a non-trivial working application at the end of it. My one criticism is that it's too hard to try to follow along and write the code as you go because there are too many changes from each step to step that aren't discussed in the screenc

Re: Patch: java.util.Map support

2008-09-30 Thread Paul Barry
On Sep 30, 11:17 am, Rich Hickey <[EMAIL PROTECTED]> wrote: > I've been thinking about this Map vs Collection issue for a while now > and am considering making the move to: Clojure maps implement Java > Map. Yes, please do! +1! --~--~-~--~~~---~--~~ You received th

Re: Clojure at Boston Lisp Meeting videos

2008-10-02 Thread Paul Barry
Another suggestion for Mac users, install Miro, it's free, and it automatically downloads new videos, makes it easy to watch them in fullscreen: http://subscribe.getmiro.com/?url1=http://clojure.blip.tv/rss On Oct 2, 7:51 am, Rich Hickey <[EMAIL PROTECTED]> wrote: > On Oct 2, 3:56 am, scottjad <

Re: true?

2008-10-03 Thread Paul Barry
I agree with Stuart, I can't imagine this is how anyone new to Clojure would expect this to work: user=> (contains? [2 3 4] 1) (contains? [2 3 4] 1) true user=> (contains? [2 3 4] 4) (contains? [2 3 4] 4) false user=> (contains? (seq [2 3 4]) 1) (contains? (seq [2 3 4]) 1) false user=> (contains?

Re: true?

2008-10-03 Thread Paul Barry
On Oct 3, 10:26 am, Stuart Halloway <[EMAIL PROTECTED]> wrote: > But somebody is going to need to write a book to explain these odd corners   > to people coming from the Java world. Bwa ha ha ha ha. :-) > > Stuart Seriously, Clojure for Java Developers would be a great book. The biggest topic th

Re: slurp is in Clojure, but spit is in Contrib?

2008-10-06 Thread Paul Barry
+1 On Oct 6, 10:43 am, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > If this gets traction, please also consider a name change to something   > more along the lines of "read-file" and "write-file". > > --Steve --~--~-~--~~~---~--~~ You received this message bec

Re: regex literal syntax

2008-10-09 Thread Paul Barry
What about having #"pattern" work like is does now, and then having #/ pattern/ work similarly to Ruby, Python, Perl, etc. regular expression in that they not require double escaping of characters like '\'? So in other words: #/(.*?)<\/em>/ instead of: #"(.*?)<\\/em>" The advantage to

Dealing with keyword-keyed maps in Java land

2008-10-13 Thread Paul Barry
Now that clojure maps are Java Maps, it is easier to inter-operate with Java code that has methods that take a Map as one of its arguments, because you can just pass the Map right into the Java code. The problem is that often times, the Java method is expecting the Map to have String values in th

Re: Dealing with keyword-keyed maps in Java land

2008-10-13 Thread Paul Barry
I'm thinking about cases where you are using existing java libraries that you don't want to/can't re-write to have Clojure specific code in them. I think the rule for dealing with conflicts would be to give me the value for the String if it's there, if it's not, try to give me the value for the K

Re: Dealing with keyword-keyed maps in Java land

2008-10-13 Thread Paul Barry
ughts? Should I change the model layer to return String-keyed maps? Or convert the Keywords to Strings before building the VelocityContext? On Oct 13, 9:58 am, Rich Hickey <[EMAIL PROTECTED]> wrote: > On Oct 13, 9:34 am, Paul Barry <[EMAIL PROTECTED]> wrote: > > > > &g

Re: Dealing with keyword-keyed maps in Java land

2008-10-13 Thread Paul Barry
ow an Exception rather than return false also. On Oct 13, 11:22 am, Rich Hickey <[EMAIL PROTECTED]> wrote: > On Oct 13, 10:17 am, Paul Barry <[EMAIL PROTECTED]> wrote: > > > > > To give a specific example of what I'm trying to do, I'd like to use > >

Re: Dealing with keyword-keyed maps in Java land

2008-10-13 Thread Paul Barry
I was thinking this is a little different because the Keyword data type is unique to Clojure. So once in the Java land, you are never going to want to use Keywords. In Clojure, I agree, the difference between Keyword and String should be explicit, but in Java, I feel like it's just pragmatic to

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

2008-10-17 Thread Paul Barry
Baltimore, Maryland, US On Oct 17, 5: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 Slovaki

Re: Beginners (and idiomatic Clojure)

2008-10-19 Thread Paul Barry
Krukow, I agree, it would help to have a resource for learning Clojure. For now, my best advice is to pick a real project to start working and then specific questions in the IRC room, #clojure on irc.freenode.net. Within a few months, we'll have the beta book: http://www.pragprog.com/titles/shc

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

2008-10-19 Thread Paul Barry
I like this idea and I would be willing to contribute. On Oct 19, 6:43 pm, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > On Oct 19, 2008, at 5:11 PM, J. McConnell wrote: > > > I've been thinking the same thing for awhile now and I'd love to help > > contribute to an effort like this. Thanks f

Re: (source name)

2008-11-03 Thread Paul Barry
I agree that this would be helpful. On Nov 2, 6:34 pm, Mark McGranaghan <[EMAIL PROTECTED]> wrote: > I really like being able to find and check documentation in the REPL > with find-doc and doc, but I often would like to see the source code > of a function or macro to be able to understand it bet

Why are symbols resolved when a function is defined?

2008-11-10 Thread Paul Barry
In Common Lisp and Scheme, if you have an expression that evaluates a symbol, it doesn't evaluate it until you call the function, not when you define it. So you can do this: Common Lisp: [1]> (defun b () a) B [2]> (defvar a 5) A [3]> (b) 5 Scheme: 1 ]=> (define (b) a) ;Value: b 1 ]=> (define a

Re: Namespaces and distinctness

2008-11-19 Thread Paul Barry
I would prefer to see this not become a convention in Clojure. The reason why is the first part of your domain is unimportant and possibly likely to change. The hibernate project was a good example of this. They were first hosting it on sourceforge, so they made all their packages net.sf.hibern

Re: mutability

2008-11-20 Thread Paul Barry
Sure, I'd be interested in porting it, would give me a reason to learn Scala :). Just post the code to github or something and let us know where it's at. On Nov 20, 10:42 pm, islon <[EMAIL PROTECTED]> wrote: > I gave up, the resulting code would be a lot more complex than the > scala version. >

Clojure at RubyConf

2008-11-30 Thread Paul Barry
I just watched Jim Weirich's talk from RubyConf. He does a good job of showing the basics of why concurrent programming is hard, and briefly talks about Erlang and Clojure at the end. I recommend it to anyone interested in Clojure: http://rubyconf2008.confreaks.com/what-all-rubyist-should-know-

quit

2008-11-30 Thread Paul Barry
It's a minor thing, but wouldn't it be a good idea to put (defn quit [] (System/exit 0)) in clojure core, just to make quitting out of the REPL more obvious? Ctrl-C and Ctrl-D work too, and are actually shorter to type, but having a quit function seems to be an idiomatic way of getting out of the

Re: DISCUSS: replace (rand)

2008-12-01 Thread Paul Barry
Looks like the only synchronization is for lazy initialization of the instance of Random used by the static method: public final class Math { private static Random randomNumberGenerator; private static synchronized void initRNG() { if (randomNumberGenerator == null)

Re: DISCUSS: replace (rand)

2008-12-02 Thread Paul Barry
Ah, I didn't see the call to next. The java docs do say that is the implementation for that method, but they are lying: protected int next(int bits) { long oldseed, nextseed; AtomicLong seed = this.seed; do { oldseed = seed.get(); nextseed = (o

Re: DISCUSS: replace (rand)

2008-12-02 Thread Paul Barry
Since this is just pure java, shouldn't it be the same on all 1.5 JVMs? Would it be different on other JVM implementations? Just to verify, I checked on my Mac OS X 10.5 and in the Sun JDK 1.5 on Windows XP, and it does appear to be the same. On Dec 2, 9:17 am, Stuart Halloway <[EMAIL PROTECTED

Lisp/Clojure doesn't have syntax?

2008-12-11 Thread Paul Barry
I've been reading the latest chapter from Stuart's book, Chapter 7: Macros, and he makes this statement: "Clojure has no special syntax for code. Code is simply Clojure data. This is true for normal functions, but also for special forms and macros. Consider a language with syntax, such as Java. .

Re: Lisp/Clojure doesn't have syntax?

2008-12-11 Thread Paul Barry
On Dec 11, 4:44 pm, Randall R Schulz wrote: > All these things are syntactic sugar. Shorthand ways to write things > that have vanilla S-Expression counterparts. Again, I would not call > them syntax. syntactic sugar is not syntax? --~--~-~--~~~---~--~~ You recei

Re: Lisp/Clojure doesn't have syntax?

2008-12-12 Thread Paul Barry
On Dec 11, 6:19 pm, Rich Hickey wrote: > Yes, the critical point is that the text-based representation of code > is completely secondary: > (def x (list (list (symbol "fn") (vector) "Hello World"))) > > (class (second (first x))) > -> clojure.lang.PersistentVector > > (class (first (first x)))

Re: what does -> mean?

2008-12-29 Thread Paul Barry
You can look up the documentation for a function/macro interactively from the repl: user=> (doc ->) - clojure.core/-> ([x form] [x form & more]) Macro Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a

Re: Fibonacci sequence

2008-12-29 Thread Paul Barry
Craig, Something you should be aware of is that this implementation of Fibonacci is very inefficient. For more info as to why, you can read: http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-11.html#%_sec_1.2.2 The short story is doing it this way performs a lot of wasted calculations as n

Re: clj-backtrace: more readable backtraces for Clojure

2009-01-04 Thread Paul Barry
This is very nice, any chance we could see this added to clojure contrib? On Thu, Jan 1, 2009 at 9:30 PM, Mark McGranaghan wrote: > > Hi all, > > I'm happy to announce an alpha release of clj-backtrace, a library for > processing backtraces generated by Clojure programs. The library works > by s

Re: quote on side effects

2009-01-05 Thread Paul Barry
I thought that first place I heard it was Rich mentioning it in one of the videos on http://clojure.blip.tv, but I can't find it. On Mon, Jan 5, 2009 at 3:48 PM, Mark Volkmann wrote: > > I'm trying to recall where I heard a quote that goes something like this. > > "If none of your functions have

Re: quote on side effects

2009-01-05 Thread Paul Barry
I didn't think you originated the quote, but did you mention it during one of your presentations? Maybe I'm thinking of someone else. On Mon, Jan 5, 2009 at 6:09 PM, Rich Hickey wrote: > > On Mon, Jan 5, 2009 at 5:04 PM, Paul Barry wrote: > > I thought that first pla

Re: Collecting items in an interface method call

2009-01-06 Thread Paul Barry
I don't see any way to do that without appending to a list of some sort. Based on the way this library is written, that's true of Java or Clojure, since SVNLogClient doesn't appear to have any methods to return a Collection, just these doList methods, which forces you into a side effect style of p

Re: Very noob file reading and printing question

2009-01-07 Thread Paul Barry
Here's a little cleaner version using doseq: (use 'clojure.contrib.duck-streams) (with-open [r (reader "doc.txt")] (doseq [line (line-seq r)] (println line))) On Wed, Jan 7, 2009 at 7:27 AM, Tom Ayerst wrote: > Thanks Brian. > > I finally nailed it with: > > (use '[clojure.contrib.duck-strea

Re: Very noob file reading and printing question

2009-01-07 Thread Paul Barry
t didn't print anything. I had: > (with-open [r (reader "doc.txt")] >(doseq [line (line-seq r)] println line)) > > so I wasn't evaluating the println. > > Cheers > > Tom > > 2009/1/7 Paul Barry > > Here's a little cleaner version usin

Re: writing bytes to a file

2009-01-07 Thread Paul Barry
clojure.contrib.duck_streams/spit? On Wed, Jan 7, 2009 at 2:14 PM, Brian Doyle wrote: > I couldn't find anything in core or contrib that wrote out > bytes to a file so I wrote something to do it. Is this > functionality already implemented and I just couldn't find > it? If there isn't anythi

Re: [ANN] Ring: A Web application library for Clojure.

2009-01-12 Thread Paul Barry
What's does the req object that is passed into the function have in it? On Mon, Jan 12, 2009 at 11:45 PM, Mark McGranaghan wrote: > > Hi All, > > I'm happy to announce the alpha release of 'Ring', a library inspired > by Python's WSGI and Ruby's Rack for developing web applications in > Clojure.

Re: [ANN] Ring: A Web application library for Clojure.

2009-01-12 Thread Paul Barry
to your function. Great Work! On Tue, Jan 13, 2009 at 1:13 AM, Paul Barry wrote: > What's does the req object that is passed into the function have in it? > > > On Mon, Jan 12, 2009 at 11:45 PM, Mark McGranaghan wrote: > >> >> Hi All, >> >> I'm

Re: Example Java oriented SWT GUI application in Clojure

2009-01-15 Thread Paul Barry
It's probably this: http://www.eclipse.org/swt/faq.php#carbonapp On Thu, Jan 15, 2009 at 9:20 PM, e wrote: > anyone able to get this going on a Mac yet? The main window comes up, but > shortly after crashes. > > > On Mon, Jan 12, 2009 at 5:24 PM, BerlinBrown wrote: > >> >> Here is an example SW

Re: [DISCUSS] Use an Issue tracker?

2009-01-23 Thread Paul Barry
What's wrong with google code? http://code.google.com/p/clojure/issues/list On Fri, Jan 23, 2009 at 5:29 PM, Howard Lewis Ship wrote: > > I'm always a fan of using a real issue tracking system; I'd love to > see Clojure using JIRA to track what's going on, and what's coming up, > in a public and

Re: reader macros

2009-01-23 Thread Paul Barry
Mark, Yes, I think so. My understanding of a reader marco is a character or set of characters that is a shortcut for some other special form/macro that you could use if the reader macro didn't exist. By that definition, I think [...] and {...} are also reader macros. I think \ just part of the l

Re: Simple Examples of Concurrency?

2009-01-29 Thread Paul Barry
Keith, Are you planning on going to the DC Clojure Study Group on Saturday? Concurrency is the topic and I've got some good exercises planned for us to work on. Also be sure to read Ch 6 in Stuart's book. On Tue, Jan 27, 2009 at 3:06 AM, Keith Bennett wrote: > > All - > > I'm trying to wrap my

Re: Alternatives to contains?

2009-01-29 Thread Paul Barry
This is actually the point of this whole debate. You would assume that contains? works like java.util.Collection.contains, but instead it means something completely semantically different. user=> (.contains [4 5 6] 4) true user=> (contains? [4 5 6] 4) false Even worse, you do this and think it wo

Restarting a transaction with commute?

2009-02-01 Thread Paul Barry
My understanding of commute is that it would not restart the transaction, it would just apply the function. So I wrote this little test program: (defmacro in-thread [& body] `(.start (Thread. (fn [] (println "Thread" (.getId (Thread/currentThread)) " started") ~...@body

Re: Memory Consumption of Large Sequences

2009-02-02 Thread Paul Barry
Ketih, I think what you have done, at least at the JVM level, is create 100,000 lists, with basically each list containing an element and a pointer to the next element. Because one list points to the next, none of them can be garbage collected. It seems to me that this would be roughly equivalen

Re: pointfree library

2009-10-28 Thread Paul Barry
Would love to see some examples usages of these On Sun, Oct 25, 2009 at 4:16 PM, harrison clarke wrote: > > so i was using haskell, and the pointfree stuff is fun, so naturally i > had to implement some of it in clojure. > > this is what i have so far. library and examples within: > http://github

Re: Documentation lacking for ns macro

2010-11-05 Thread Paul Barry
(inc) On Thu, Nov 4, 2010 at 2:41 PM, Ken Wesson wrote: > The ns macro seems to be poorly documented as yet. The Namespaces page > at the main Clojure site does not go into detail about its syntax; > "doc ns" comes closer, with: > > (ns foo.bar >(:refer-clojure :exclude [ancestors printf])