Re: Clojure Golf – Episode 2: Largest Prime Factor

2009-09-10 Thread Adrian Cuthbertson
What about a golf competition on the golf competition scorer? Then we can evaluate that using; (defmacro score-scorer [scorer] ... ) :) - Adrian On Thu, Sep 10, 2009 at 8:12 AM, Christophe Grand wrote: > > I propose to compute the score of a golf competition entry using this > function: > (d

Re: Library problem: SWT and Emacs

2009-09-10 Thread recent596
srolls and Laurent, Thanks for your replies. I still can't figure it out and I'm switching to eclipse. On Sep 10, 12:45 am, srolls wrote: > I have had similar issues with swing. Going to the inferior lisp buffer and > hitting return once or twice always resolved it. It only happens the first >

Re: clojure-mode survey

2009-09-10 Thread Rick Moynihan
2009/9/10 Phil Hagelberg : > > Rick Moynihan writes: >> This issue has got me thinking that the real problem appears to be >> that there isn't a standard or default way (script) to start up and >> run java/clojure projects... i.e. though this solves the problem when >> running clojure programs in

Re: Clojure Golf – Episode 2: Largest Prime Factor

2009-09-10 Thread Mark Reid
Hi, On Sep 10, 3:52 pm, MarkSwanson wrote: > Just for fun I actually tried this: > > Clojure=> (time (lpf6b 1234567890123456789012345678901234567890)) > The prime factorization of 1234567890123456789012345678901234567890 > is :5964848081 > "Elapsed time: 5519.278432 msecs" > > I can't confirm th

Re: Clojure Golf – Episode 2: Largest Prime Factor

2009-09-10 Thread MarkSwanson
> Just thought you would like to know that Wolfram|Alpha agrees (in > roughly the same time): > > http://www.wolframalpha.com/input/?i=factor+1234567890123456789012345... Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Goo

Re: clojure-mode survey

2009-09-10 Thread CuppoJava
I still use clojure-mode and it's basic LISP interaction features. I've installed SLIME once and went through the hassle of getting it working, but it didn't (seem) to offer much more. It also made quitting an infinite loop difficult (C-c C-c didn't work for me in SLIME). So eventually i just move

Re: Printing to be read

2009-09-10 Thread B Smith-Mannschott
On Wed, Sep 9, 2009 at 00:16, Richard Newman wrote: > >> So, my question is this: is there a way to print a structure out in >> a fashion that it can be read back in correctly (i.e. with strings >> being quoted), and without having to write my own print function? > > prn. > > user=> (prn {:foo ["

Re: Printing to be read

2009-09-10 Thread Michael Wood
2009/9/9 Brian Hurt : [...] > So, my question is this: is there a way to print a structure out in a > fashion that it can be read back in correctly (i.e. with strings being > quoted), and without having to write my own print function? To go along with the other answers, you will want to bind *rea

Class function alwayrs returns java.lang.class??

2009-09-10 Thread Gorsal
Hello. I'm trying to use (class String) to get the class object for the String class. However, nomatter what class typ ei pass, i always get java.lang.Class back. Is this the way its supposed to work? Thx! --~--~-~--~~~---~--~~ You received this message because yo

Re: Class function alwayrs returns java.lang.class??

2009-09-10 Thread Adrian Cuthbertson
You need to pass the object to (class, e.g... user=> (class "a") java.lang.String user=> (class String) java.lang.Class user=> (class 1) java.lang.Integer (So String is actually a Class object). Rgds, Adrian. On Thu, Sep 10, 2009 at 5:00 PM, Gorsal wrote: > > Hello. I'm trying to use (class St

Re: Class function alwayrs returns java.lang.class??

2009-09-10 Thread Laurent PETIT
Yes. (class "an instance of Stirng") will return java.lang.String Now the clojure symbol String is bound to a java.lang.Class instance giving information on the java.lang.String class (as if you had issued "kljlkjk".getClass()). 2009/9/10 Gorsal > > Hello. I'm trying to use (class String) to ge

Re: Class function alwayrs returns java.lang.class??

2009-09-10 Thread Garth Sheldon-Coulson
What you're getting is the class of the String class, which is Class. What you want is just plain "String". On Thu, Sep 10, 2009 at 11:00 AM, Gorsal wrote: > > Hello. I'm trying to use (class String) to get the class object for > the String class. However, nomatter what class typ ei pass, i alw

Clojure and SOAP

2009-09-10 Thread Adie
Hello, I am looking to write a SOAP client in Clojure and was wondering if there are any good existing libraries/clients in Java. After a bit of searching i came across Apache Axis and JAX-WS, though i am not sure how useful they will be and JAX-WS uses annotations. Has anyone had any experience

Re: clojure-mode survey

2009-09-10 Thread Rick Moynihan
2009/9/9 Phil Hagelberg : > > The solution I've settled on is the clojure-project function: > >    (defun clojure-project (path) >      "Setup classpaths for a clojure project and starts a new SLIME session. >      Kills existing SLIME session, if any." >      (interactive (list >                

RE: Class function alwayrs returns java.lang.class??

2009-09-10 Thread Seth Burleigh
Ah. So class returns the class of the instance, and does not find the class with the name given. So , if I wanted to get the class of a ExecutionEvent, I would Have to go (Class/forName "org.eclipse.core.commands.ExecutionEvent")? Preferrably, I would like to simply go (Class/forName "ExecutionE

Re: Class function alwayrs returns java.lang.class??

2009-09-10 Thread J. McConnell
On Thu, Sep 10, 2009 at 1:20 PM, Seth Burleigh wrote: > Ah. So class returns the class of the instance, and does not find the > class with the name given. > Yes. > So , if I wanted to get the class of a ExecutionEvent, I would > > Have to go (Class/forName "org.eclipse.core.commands.ExecutionEv

Re: Clojure and SOAP

2009-09-10 Thread Jeff Sapp
I've been working on a project (both client and server) for the last few weeks using Clojure and SOAP. I looked around for anything SOAP related and didn't find much. I ended up just using the Apache Axis library. Their WSDL2Java saved me quite a bit of time. Right now I have more java code than

How to define multiple methods at once

2009-09-10 Thread pmf
Hi, I'd like to know whether there is already something in clojure.contrib that installs a method with multiple dispatch-values, i.e. given a multimethod like: (defmulti some-multi identity) instead of installing several methods with different dispatch values that do the same thing: (defmethod

Re: How to define multiple methods at once

2009-09-10 Thread Richard Newman
> (hypothetic-defmethods some-multi [:a :b] [arg] (do-something)) Multimethods are dispatched using isa?. The idiomatic Clojure way of doing what you want is to define *one* method against something higher up in the hierarchy than both :a and :b. For example, if your two values are ::get and

Re: How to define multiple methods at once

2009-09-10 Thread pmf
> The idiomatic Clojure way of doing what you want is to define *one*   > method against something higher up in the hierarchy than both :a and :b. > > For example, if your two values are ::get and ::head, perhaps you   > should be defining a handler for ::idempotent-http-method. Thanks; fits perf

Re: Content negotiation?

2009-09-10 Thread Richard Newman
http://github.com/rnewman/clj-conneg/tree/master This is now pretty much finished, apart from more detailed sorting. E.g., you can ask: (conneg/best-allowed-content-type "image/*; q=0.9, text/html; q=0.1, text/plain; q=0.8" #{"image/jpeg"}) => ("image" "jpeg") i.e., it co

Lisp indenter for Kate

2009-09-10 Thread icemaze
I wrote a Kate script to make lisp development on Kate a little more pleasant. It was written primarily with Clojure in mind, so it should work best with this language, but it's pretty generic. If you use Kate, please try it and feel free to add a comment to the kde bug report (see below). You c

Re: clojure-mode survey

2009-09-10 Thread Phil Hagelberg
Tom Faulhaber writes: > Also, one thing that I (and others) have noticed is that clojure mode > chokes on the #^{} form metadata on namespaces. (See any of the files > in clojure-contrib for an example.) I'm not able to reproduce the > problem now, so if you don't already know what it is, I'll k

Re: minor grievance with arithmetic on characters

2009-09-10 Thread ataggart
I'd like to second all of this. The very first time I had to fix someone else's bug was when the dev used "a.compareTo(b) == -1". On Sep 9, 1:37 am, B Smith-Mannschott wrote: > On Tue, Sep 8, 2009 at 23:35, Stephen C. Gilardi wrote: > > > On Sep 8, 2009, at 2:14 AM, Timothy Pratley wrote: > >

Re: Looping idiom

2009-09-10 Thread atreyu
uau cutting the Gordian knot On 8 sep, 05:39, Timothy Pratley wrote: > Yet another way :) > > user=> (map + (rest a) a) > (3 5 7 9 11) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this