Re: Questions about program design

2010-04-26 Thread Paul Drummond
Hi Andrew, It's getting old now but you mind find this helpful: http://groups.google.com/group/clojure/browse_thread/thread/6333791e49fbca7f/c724f1681dac3102?lnk=gst&q=drummond#c724f1681dac3102 and this: http://clojure.org/state Cheers, Paul Drummond On 25 April 2010 18:45, Andrew

Re: The Path to 1.0

2009-04-17 Thread Paul Drummond
2009/4/18 Laurent PETIT : > [snip] at least Rich disagrees (and unanimity > implies "all people", not even one let apart). > And you can also count on me, Meikel Brandmeyer (author of VimClojure), > maybe Paul Drummond (?) that pointed to python's decision to use Mercu

Re: clojure-swank and macro expansion

2009-04-17 Thread Paul Drummond
and I've added that feature. Again, this > needs contrib so if it's not there it'll fallback on plain old > macroexpand. > > - Jeff > > On Apr 17, 2:22 pm, Paul Drummond wrote: >> Thanks guys - it's great that this is in clojure-swank now as well!  I >&g

Re: The Path to 1.0

2009-04-17 Thread Paul Drummond
2009/4/17 Tom Faulhaber : > 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

Re: The Path to 1.0

2009-04-17 Thread Paul Drummond
2009/4/17 Laurent PETIT : > 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 ) I agree the la

Re: clojure-swank and macro expansion

2009-04-17 Thread Paul Drummond
ring] >>  (binding [*print-suppress-namespaces* true] >>    (with-pprint-dispatch *code-dispatch* >>      (write (expander (read-from-string string)) :pretty true :stream >> nil >> >> Now that pprint is a part of contrib, these two changes should probably be >

clojure-swank and macro expansion

2009-04-17 Thread Paul Drummond
Up until now I have made do with a simple clojure repl in Emacs but as I am playing around with macros I feel it's time to test drive clojure-swank and it's fancy macro expansion features! I have installed clojure-swank following the instructions on the wiki and the installation seems to have wor

Re: The Path to 1.0

2009-04-17 Thread Paul Drummond
2009/4/16 Rich Hickey : > What does 1.0 mean to you? I just wanted to give some thoughts on what I think are the main points coming from this discussion. It seems like most agree that "Clojure the language" is ready for a 1.0 release (and all that comes with it). The main issues are A) choice o

Re: Macros, let and variable capture

2009-04-09 Thread Paul Drummond
2009/4/9 Christophe Grand : > The problem is with the last two lines of your macro (the let expansion > is fine): > >      (.add l) >      (.add b > Do you really want to hardcode l and b here or emit as many .add as > required? No - this is where the macro is incomplete - these lines are jus

Macros, let and variable capture

2009-04-09 Thread Paul Drummond
Hi, I am trying to define a macro something like this: (defwidget (vlayout (create-button b) (create-label l)) (on-event b "pressed" (fn [] (.setText l "Hello World" After a lot of messing around (I am learning all the time here!) I have a version of defwidget that ge

Re: How to flatten a coll only 1 level deep?

2009-04-09 Thread Paul Drummond
2009/4/9 Chouser : > (defn flat1 [coll] >  (mapcat #(if (coll? %) % [%]) coll)) Ah, I see. So for each item, if its already a collection we leave it alone and if not we make a vector of one item, then at the end we use mapcat to concatinate all the top-level items into one list. Excellent - tha

How to flatten a coll only 1 level deep?

2009-04-08 Thread Paul Drummond
I am looking for something similar to flatten (in contrib.seq-utils) but the function will only flatten one level deep: [ 1 2 3 [4 5 [6 7] ] ] ---> [ 1 2 3 4 5 [6 7] ] I have tried combining functions in the seq library and I've studied the code for flatten and tree-seq to look for hints but so

Re: Possible bug in proxy: NPE for unqualified class

2009-04-05 Thread Paul Drummond
2009/4/3 Rich Hickey : > Could you please submit an issue for that one? No problem: http://code.google.com/p/clojure/issues/detail?id=102 Thanks, Paul. -- Iode Software Ltd, registered in England No. 6299803. Registered Office Address: 12 Sancroft Drive, Houghton-le-Spring, Tyne & Wear, DH5 8N

Possible bug in proxy: NPE for unqualified class

2009-04-03 Thread Paul Drummond
The following works - note ActionListener is fully qualified: - user=> (.addActionListener (javax.swing.JButton.) (proxy [java.awt.event.ActionListener] [] (actionPerformed [evt] (println "button press" nil -

Re: Trying to get a list of random numbers using repeat

2009-03-26 Thread Paul Drummond
2009/3/26 Jon : > You probably figured this out, but what you want is something like: > (map rand-int (repeat SIZE MAX)) In fact - I didn't think of this - thanks! This is what I used: (map rand-int (repeat Integer/MAX_VALUE)) I have been around since the beginning of Clojure but my journey to

Re: Trying to get a list of random numbers using repeat

2009-03-25 Thread Paul Drummond
2009/3/25 David Plumpton : > I think this explains your problem: > http://xkcd.com/221/ There is something to be said for that function. At least it has no side-effects ;) -- Iode Software Ltd, registered in England No. 6299803. Registered Office Address: 12 Sancroft Drive, Houghton-le-Spring,

Re: file io

2009-03-25 Thread Paul Drummond
2009/3/25 e : > For example, "slurp" is, perhaps, marginally better than "read" because it > may help express that it reads the whole file. Anyone else hate the names 'slurp' and 'spit' as much as me? IMO changing these names would be a great idea whether these functions are moved up to core or

Re: Trying to get a list of random numbers using repeat

2009-03-24 Thread Paul Drummond
2009/3/24 Joshua Fox : >> Why "presumably with side effects?" > Otherwise you would use repeat. A pure  function returns the same value > every time, so there is no reason to call it repeatedly. Yup, that makes sense. Random numbers are side-effecting (is that the right term?) and I was trying t

Re: Trying to get a list of random numbers using repeat

2009-03-24 Thread Paul Drummond
2009/3/23 Krešimir Šojat : > (rand-int 49) will produce one integer, and repeat will repeat it 10 > times, that is why you see same number repeated. How embarrassing! As soon as I switched my machine off last night I realised rand-int was only being called once - of course it was! I did consid

Trying to get a list of random numbers using repeat

2009-03-23 Thread Paul Drummond
Hi all, user=> (repeat 10 (rand-int 49)) (4 4 4 4 4 4 4 4 4 4) Can someone please tell me why this doesn't work? It must be something obvious but I can't see the wood for the trees right now - it's late and my head hurts! Thanks, Paul. -- Iode Software Ltd, registered in England No. 6299803.

Re: March 20th 2009 Rich Hickey Appreciation Day!

2009-03-23 Thread Paul Drummond
I'm (fashionably?) late to share my appreciation. Excellent language - I can only imagine good things for Clojure in the future. Thanks Rich! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post

Re: Which Java book(s) to order

2009-03-16 Thread Paul Drummond
2009/3/16 Paul Stadig : > The 3rd edition of Thinking in Java is available on the author's website for > free. > > http://www.mindview.net/Books/TIJ/ > That's true but beware it is quite old now and doesn't cover Java 5 or 6. The fourth edition (which isn't freely available) is the latest and it

Re: Which Java book(s) to order

2009-03-16 Thread Paul Drummond
but then so is the Java language :) 2. Effective Java by Joshua Bloch Not for learning Java but excellent for learning how to write quality Java code. A must read IMO. 3. Java Concurrency in Practise I have not read this yet but I want to as Rich praises it in his concurrency talk. Chee

Re: Witch Emcas for Windows to use with Clojure

2009-03-11 Thread Paul Drummond
Not sure about "XEmacs vs Gnu Emacs" but for GNU Emacs there are some options. By far the best option when starting out is ClojureBox: http://clojure.bighugh.com/ It's a one-click installer to get you started. It includes everything you need to develop in Clojure with Emacs including Slime. I

Re: Two quick questions on functions...

2009-03-10 Thread Paul Drummond
Hi Rich, for your first issue "declare" does exactly what you want. => (doc declare) - clojure.core/declare ([& names]) Macro defs the supplied var names with no bindings, useful for making forward declarations. nil Cheers, Paul. 2009/3/10 Rich : > > I'm relatively n

Gorilla: Vim For Windows with Ruby Support

2009-03-09 Thread Paul Drummond
Hi all, I just thought I would share that I managed to get Gorilla working in Windows by using special build of of Vim 7.2 with Ruby support by Wu Yongwei. The page is linked to from the vim-online download. Here's the link: http://wyw.dcweb.cn/#download It contains gvim.exe and vim.exe so I

Re: Can't get clojure or clojure.contrib via SVN over https

2009-01-14 Thread Paul Drummond
2009/1/14 Cosmin Stejerean > You could try moving to something like git and checking out the source code > from one of the unofficial mirrors, like http://*github*.com/kevinoneill/* > clojure* > Works perfectly - thanks! I considered trying git but didn't have a clue where to look for mirrors -

Re: Can't get clojure or clojure.contrib via SVN over https

2009-01-14 Thread Paul Drummond
2009/1/14 Mark Feeney > > I was just referring to the svn command you posted in your original > message: > > > svn checkout > http://clojure-contrib.googlecode.com/svn/trunk/clojure-contrib > > What it should be is: > > svn checkout http://clojure-contrib.googlecode.com/svn/trunk/ clojure- > con

Re: Can't get clojure or clojure.contrib via SVN over https

2009-01-14 Thread Paul Drummond
2009/1/14 Rich Hickey > I think the salient difference is http, not https, for non-members. Hi Rich, The point is that I could use https on Sourceforge to get around the proxy issue. I've had the same problem before when using SVN for Clojure (sourceforge) and assembla (a personal repos). W

Re: Can't get clojure or clojure.contrib via SVN over https

2009-01-14 Thread Paul Drummond
2009/1/14 Mark Feeney > > (no /clojure-contrib on the end of the URL now) > Thanks for your reply Mark but I don't get what you mean. Can you elaborate? You say "no /clojure-contrib on the end of the URL" but it's not on there anyway. The url is exactly as it is on the google-code checkout pa

Can't get clojure or clojure.contrib via SVN over https

2009-01-14 Thread Paul Drummond
Hi all, I realised today that my "work" machine still has the old Sourceforge version of clojure-contrib but when I try to get the latest version from google-code it falls over - most likely due to a proxy: >svn checkout http://clojure-contrib.googlecode.com/svn/trunk/clojure-contrib svn: REPORT

Re: clojure-contrib documentation

2008-12-09 Thread Paul Drummond
Hi Mark, Most modules in clojure-contrib (including test-is) contain documentation and examples directly in the header comment of the source file. Cheers, Paul. 2008/12/9 Mark Volkmann <[EMAIL PROTECTED]> > > Is there a primary website that provides documentation and examples of > using the var

Re: fix imports

2008-12-01 Thread Paul Drummond
2008/12/1 Michael Wood <[EMAIL PROTECTED]> > I think his point is that if he gets an "Unable to resolve symbol: > Polygon" error and also an "Unable to resolve symbol: Point2D" error > then he still has to figure out which one is in java.awt and which is > in java.awt.geom. He wants a tool to spi

Re: fix imports

2008-12-01 Thread Paul Drummond
2008/11/28 Martin DeMello <[EMAIL PROTECTED]> > No, I'd be perfectly happy with a command line tool that could analyse > my clojure program and tell me what imports I'm missing - I just don't > want to have to tediously go through the javadocs one by one and see, > for instance, that I need java.a

Re: fix imports

2008-11-28 Thread Paul Drummond
Hi Martin, Well, this is the sort of feature provided by IDEs rather than editors as you say, so it's not a "clojure" specific issue. It's whether your chosen IDE supports the feature you require. FYI, there is a NetBeans plugin (http://enclojure.org/) and a Eclipse plugin (http://code.google.co

Re: Clojure in MathRider (an easy way for newbies to experiment with Clojure code)

2008-11-19 Thread Paul Drummond
This looks very interesting but when I try to execute clojure code (either from the editor or the REPL) I get the following error: "Could not initialize class clojure.lang.RT" 2008/11/18 Ted Kosan <[EMAIL PROTECTED]> > > I am in the process of developing a mathematics-oriented IDE called > Math

Re: POLL: Domain name for project hosting site.

2008-11-18 Thread Paul Drummond
At the risk of sounding like an old fart, I cringe when I hear "Clojury" and "Jewel" - they are too "cute" (as Rich nicely put it a while back - http://groups.google.com/group/clojure/msg/0351ca20c758b0b3). I agree with Brian Carper - we should keep it readable so +1 for something like "clojurefor

Re: clojure.contrib.test-is changes

2008-11-17 Thread Paul Drummond
Hi Stuart, Cool additions - I will certainly use them. Regarding test-is additions, did you ever get a chance to check out the patch I submitted a while back? http://groups.google.com/group/clojure/browse_thread/thread/c509d589e181df1e/4319c02c9930d12e?lnk=gst&q=PATCH+test-is#4319c02c9930d12e I

Re: Where are the tests?

2008-11-13 Thread Paul Drummond
2008/11/12 Howard Lewis Ship <[EMAIL PROTECTED]> > > I'm looking at the Clojure SVN and I'm wondering, where are the unit > tests? > There is test-clojure in clojure-contrib - see the following thread for details: http://groups.google.com/group/clojure/browse_thread/thread/697d59883a273795/bb057

Re: Swing GUI Builder and Clojure

2008-11-04 Thread Paul Drummond
2008/11/4 Rich Hickey <[EMAIL PROTECTED]> > I know people have built UIs with Netbean's Matisse, which is supposed > to be very good, and wired them up with Clojure. IMO that's a > promising approach. I have quite a lot of experience with Swing/Qt so for once I can contribute something informati

Re: Swing GUI Builder and Clojure

2008-11-04 Thread Paul Drummond
2008/11/4 Stuart Halloway <[EMAIL PROTECTED]> > > For the book would people rather see Swing or Qt Jambi examples? Personally, Qt Jambi definitely. While Swing is the standard Java UI library it pales in comparison to Qt and is still under-supported by Sun IMO. But if Qt licensing issues put p

Patch: java.lang.Error support for clojure.contrib.test_is

2008-10-30 Thread Paul Drummond
I have been using the test-is library from clojure.contrib very effectively - thanks Stuart and contributors! One thing I have noticed is that errors like StackOverflowError cause "run-tests" to terminate prematurely. I know java.lang.Errors should not be caught in general but I think it's accep

Re: Numbers API has no abs function

2008-10-29 Thread Paul Drummond
On Oct 29, 1:46 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > How about this: > >(defn abs [x] > (if (< x 0) (- x) x)) I will use that - I should have considered making my own version rather than messing around with BigDecimal.abs(). Thanks! --~--~-~--~~---

Numbers API has no abs function

2008-10-29 Thread Paul Drummond
)) java.lang.NullPointerException (NO_SOURCE_FILE:0) Would be nice to be able to use: (abs -1.0) 1 (abs 1.0M) 1M and get the overloading provided by the Numbers interface. Cheers, Paul Drummond --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: Placement of metadata in defn

2008-10-23 Thread Paul Drummond
Thanks guys, I get it now. I was forgetting that #^ attaches to the next thing read, it makes sense now! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clo

Placement of metadata in defn

2008-10-23 Thread Paul Drummond
I am a bit puzzled by how metadata seems to behave differently depeding on where it's used and whether #^ is included or not: (defn #^{:doc "doc"} my-fn ([x] x)) ;;Works (defn {:doc "doc"} my-fn ([x] x)) ;;Error: Second argument to def must be a Symbol (defn my-fn [x] x #^{:doc "doc"});;E

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

2008-10-17 Thread Paul Drummond
Sunderland, UK. --~--~-~--~~~---~--~~ 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 more o

Re: Clojure's first year

2008-10-17 Thread Paul Drummond
Congratulations Rich! I remember when Clojure was first announced (it doesn't feel like a year ago!) it was like a breath of fresh air! It was during a time when I was trying learn Lisp as a newbie and finding it hard to focus on learning the language because I couldn't settle for a particular d

Re: What Windows IDE are you using?

2008-10-15 Thread Paul Drummond
On Oct 15, 5:05 pm, Mike Hinchey <[EMAIL PROTECTED]> wrote: > I use emacs and slime, also.  Has anyone used http://jdee.sourceforge.net/ > with Clojure, or even just with Java? > I tried to get it working in Java a while back but failed miserably - I can't really remember exactly what the problem

Re: using libraries

2008-10-15 Thread Paul Drummond
It's funny how things suddenly click. While out for a run (the only time I seem to be able find clarity it seems) I started thinking that it would be nice to have macros for "require" and "use" so that you don't have to worry about quoting then I realized that's exactly what ns is for! I *should

Re: using libraries

2008-10-15 Thread Paul Drummond
On Oct 15, 2:21 pm, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > Here's the portion of (doc require) where it's mentioned: > > [...] >    Libspecs > >    A libspec is a lib name or a vector containing a lib name followed by >    options expressed as sequential keywords and arguments. > >    R

Re: using libraries

2008-10-15 Thread Paul Drummond
On Oct 15, 9:34 am, mb <[EMAIL PROTECTED]> wrote: > You might want to try (require ['clojure.contrib.zip-filter :as 'zf]). > AFAIR, you have to use [] when you want to specify :as. Ah, that's it! This isn't clear (or mentioned unless I'm mistaken) in the docs. Thanks for your help. Paul. --~--

Re: using libraries

2008-10-15 Thread Paul Drummond
Hmmm. Now I am getting this: (require 'clojure.contrib.zip-filter :as 'zf) java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.Symbol (NO_SOURCE_FILE:0) Any ideas? --~--~-~--~~~---~--~~ You received this message because you are subscrib

Re: using libraries

2008-10-14 Thread Paul Drummond
ote: > On Oct 14, 2008, at 5:24 PM, Paul Drummond wrote: > > > I want to use the zip-filter library so at the REPL I tried this: > > > (require 'clojure.contrib.zip-filter :as zf) > > > which failed with: > > > java.lang.Exception: Unabl

using libraries

2008-10-14 Thread Paul Drummond
Hi all, After a short break from hacking in Clojure I am back and eager to try out all the new features but I am having trouble getting familiar with the new lib/namespace feature. I want to use the zip-filter library so at the REPL I tried this: (require 'clojure.contrib.zip-filter :as zf) wh

Re: Clojure Poll 09/2008

2008-09-12 Thread Paul Drummond
rn to it very soon! Cheers, Paul Drummond --~--~-~--~~~---~--~~ 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