Re: Multiple return values

2008-10-20 Thread Jeffrey Chu
Hi, If you really need multiple value calls, you can always try to emulate parts of it with some fancy macros. I've hacked up a quick proof of concept - I haven't gotten a chance to test it too much, but it seems to work. http://paste.lisp.org/display/68919 - Jeff On Oct 20, 1:00 pm, "Fredrik

Re: Beginners (and idiomatic Clojure)

2008-10-20 Thread Krukow
On Oct 20, 2:02 pm, Stuart Halloway <[EMAIL PROTECTED]> wrote: > Hi Krukow, > > The quality will definitely be higher than this: > > http://blog.thinkrelevance.com/2008/9/16/pcl-clojure > > Same author, more time. :-) > > Stuart Hi Stuart, Sounds good - you have at least one buyer ;-) Will the

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

2008-10-20 Thread André Thieme
Germany here. I found Clojure just a few days ago and was quite happy about that. In fact, I felt euphoric from the beginning and still feel this way. A cleaned up Lisp with a nice and talented dictator :-) I like that it strongly asks for a functional programming style. I am thinking about starti

Debugging with JSwat

2008-10-20 Thread Craig Andera
I'm a total Clojure beginner, not to mention a C# guy with little Java experience, but as I suspect I'm not alone I'll go ahead and ask what's probably a dumb question. :) I'm writing some simple code, and I've hit the point where having a debugger would be helpful. Once I convinced clojure-swank

Re: max

2008-10-20 Thread André Thieme
On 16 Okt., 22:01, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > #(identity %) is more compactly written as: identity. > > This works: > >         user=> (apply max (filter identity '(1 2 nil 4))) >         4 > > In this case, number? is also a good predicate to use: > >         user=> (apply

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

2008-10-20 Thread Dirk Vleugels
Duesseldorf & Hamburg, Germany Cheers, Dirk --~--~-~--~~~---~--~~ 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 t

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

2008-10-20 Thread Asbjørn Bjørnstad
On Oct 20, 1:31 pm, Liu Zehua <[EMAIL PROTECTED]> wrote: > I am pretty new here. > > Guangdong, China. > but now located in Singapore. Also located in Singapore -- -asbjxrn --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Gr

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

2008-10-20 Thread Izard
Russian expat, currently in Hamilton, New Zealand Alex On Oct 21, 7:51 am, lpetit <[EMAIL PROTECTED]> wrote: > Laurent PETIT, Bron (near Lyon), France > > On Oct 20, 7:03 pm, Luc Prefontaine <[EMAIL PROTECTED]> > wrote: > > > Montreal prov. of Québec in Canada > > > Luc Préfontaine > --~--~-

Re: Multiple return values

2008-10-20 Thread Fredrik Appelberg
On Mon, Oct 20, 2008 at 1:03 PM, Parth Malwankar <[EMAIL PROTECTED]>wrote: > > On Oct 20, 3:51 pm, "Fredrik Appelberg" <[EMAIL PROTECTED]> > wrote: > > Hi all, > > > > The CL feature for handling multiple return values from a function come > in > > really handy sometimes and make for cleaner APIs.

Re: Multiple return values

2008-10-20 Thread Michel Salim
On Oct 20, 7:03 am, Parth Malwankar <[EMAIL PROTECTED]> wrote: > On Oct 20, 3:51 pm, "Fredrik Appelberg" <[EMAIL PROTECTED]> > wrote: > > > Hi all, > > > The CL feature for handling multiple return values from a function come in > > really handy sometimes and make for cleaner APIs. For example,

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

2008-10-20 Thread lpetit
Laurent PETIT, Bron (near Lyon), France On Oct 20, 7:03 pm, Luc Prefontaine <[EMAIL PROTECTED]> wrote: > Montreal prov. of Québec in Canada > > Luc Préfontaine > > On Fri, 2008-10-17 at 11:53 +0200, Mikael Hall wrote: > > I'm from sweden. > > > Mikael Hall > > > 2008/10/17 Rastislav Kassak <[EMAI

Re: destructuring/multimethods vs. pattern matching

2008-10-20 Thread Stuart Halloway
> What are your concerns re: apply? Are there performance issues? Or is > it not being able to call qsort on a collection directly? I just want the code to look pretty, no deeper concerns than that. :-) --~--~-~--~~~---~--~~ You received this message because you

Re: destructuring/multimethods vs. pattern matching

2008-10-20 Thread Achim Passen
Hi Stuart, Am 20.10.2008 um 20:00 schrieb Stuart Halloway: > Nice--I like this one, except for needing to apply. What I really want > is arity overloading *within* the first argument, which is what led me > down the path to multimethods. Yes, sadly arity matching is only available at the top le

Re: destructuring/multimethods vs. pattern matching

2008-10-20 Thread Martin DeMello
On Oct 20, 10:43 am, Stuart Halloway <[EMAIL PROTECTED]> wrote: > Hi Steve, > > Thanks! I like quicksort-4. It all fixes a problem that bugged me in   > all the other examples, which is that "bigger" is a lie. The real   > semantic is "not smaller", which quicksort-4 captures perfectly. > > I will

Re: destructuring/multimethods vs. pattern matching

2008-10-20 Thread Stuart Halloway
Hi Achim, Nice--I like this one, except for needing to apply. What I really want is arity overloading *within* the first argument, which is what led me down the path to multimethods. Is there a reason to prefer concat over lazy-cat here? Cheers, Stuart > Hi! > > Here's a variadic version:

Re: destructuring/multimethods vs. pattern matching

2008-10-20 Thread Stuart Halloway
Hi Steve, Thanks! I like quicksort-4. It all fixes a problem that bugged me in all the other examples, which is that "bigger" is a lie. The real semantic is "not smaller", which quicksort-4 captures perfectly. I will have to get used to thinking of "remove" as the opposite of "filter." The

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

2008-10-20 Thread Luc Prefontaine
Montreal prov. of Québec in Canada Luc Préfontaine On Fri, 2008-10-17 at 11:53 +0200, Mikael Hall wrote: > I'm from sweden. > > Mikael Hall > > > 2008/10/17 Rastislav Kassak <[EMAIL PROTECTED]> > > > Hello Clojurians, > > I think after 1st year of Clojure lif

Re: Multiple indexing for vectors/maps

2008-10-20 Thread kwatford
> get-in is probably what you are looking for. and > No. It does not ignore the extra parameter! This is a default value, > which is returned in case the index is not contained in the vector. Ah, cool. I was going to blame the cold medicine I was on at the time for my inability to find this inf

Re: Suggestions on handling state for a game...

2008-10-20 Thread Matt Clark
I'm still learning Clojure myself, but I've had some good luck using Rich's Ant Colony demo source as a basis for a simple game I am making. I'm not sure how well it follows what might become "best practices" for clojure game programming, but it has helped me overcome some of the initial hurdles

Re: destructuring/multimethods vs. pattern matching

2008-10-20 Thread Achim Passen
Hi! Here's a variadic version: (defn qsort ([] []) ([x & xs] (concat (apply qsort (filter #(< % x) xs)) (cons x (apply qsort (filter #(>= % x) xs)) user> (qsort 1234 56 789 0) (0 56 789 1234) Kind regards, achim Am 2

Re: destructuring/multimethods vs. pattern matching

2008-10-20 Thread Stephen C. Gilardi
On Oct 20, 2008, at 11:16 AM, Stuart Halloway wrote: > Hi all, > > I seem to recall Rich saying "I like the destructuring part of pattern > matching." In my efforts to appreciate that statement, I am playing > around with porting simple Haskell examples to Clojure, trying to use > destructuring (

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

2008-10-20 Thread Le Hoang Anh
Hanoi, Vietnam On Fri, Oct 17, 2008 at 4:27 PM, 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 Slo

destructuring/multimethods vs. pattern matching

2008-10-20 Thread Stuart Halloway
Hi all, I seem to recall Rich saying "I like the destructuring part of pattern matching." In my efforts to appreciate that statement, I am playing around with porting simple Haskell examples to Clojure, trying to use destructuring (and multimethods) where the Haskell does pattern matches.

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

2008-10-20 Thread Liu Zehua
I am pretty new here. Guangdong, China. but now located in Singapore. On Oct 18, 6:53 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hubei,China > > gerry > > On Oct 17, 5:27 pm, "Rastislav Kassak" <[EMAIL PROTECTED]> wrote: > > > Hello Clojurians, > > > I think after 1st year of Clojure l

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

2008-10-20 Thread Rhialto
Strasbourg, France --~--~-~--~~~---~--~~ 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 m

Re: Clojure + Terracotta

2008-10-20 Thread Rich Hickey
On Oct 20, 10:12 am, Alex Miller <[EMAIL PROTECTED]> wrote: > Sorry, I was not thinking straight when I wrote part of this. We will > protect you from seeing nulls by faulting values back in, even if not > read under a lock. So, what you said originally there is true. There > is a possibility

Re: Clojure + Terracotta

2008-10-20 Thread Alex Miller
Sorry, I was not thinking straight when I wrote part of this. We will protect you from seeing nulls by faulting values back in, even if not read under a lock. So, what you said originally there is true. There is a possibility that you can get dirty reads in this scenario but in the case of an i

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

2008-10-20 Thread J. McConnell
> Direct or indirect contributions to clojure.contrib require that the > contributed code be written by the contributor and that the > contributor have a contributor agreement on file with Rich. Just put mine in the mail :) --~--~-~--~~~---~--~~ You received this

Re: Beginners (and idiomatic Clojure)

2008-10-20 Thread Stuart Halloway
Hi Krukow, The quality will definitely be higher than this: http://blog.thinkrelevance.com/2008/9/16/pcl-clojure Same author, more time. :-) Stuart > On Oct 20, 12:30 am, Paul Barry <[EMAIL PROTECTED]> wrote: >> Krukow, >> >> I agree, it would help to have a resource for learning Clojure. Fo

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

2008-10-20 Thread tim
California, USA --~--~-~--~~~---~--~~ 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

Re: Multiple return values

2008-10-20 Thread Parth Malwankar
On Oct 20, 3:51 pm, "Fredrik Appelberg" <[EMAIL PROTECTED]> wrote: > Hi all, > > The CL feature for handling multiple return values from a function come in > really handy sometimes and make for cleaner APIs. For example, the ROUND > function returns the integer part of a float as the regular val

Multiple return values

2008-10-20 Thread Fredrik Appelberg
Hi all, The CL feature for handling multiple return values from a function come in really handy sometimes and make for cleaner APIs. For example, the ROUND function returns the integer part of a float as the regular value (as this is what you want most of the time), but optionally also returns the

Re: load-string string length limitation

2008-10-20 Thread Alexander Kjeldaas
Thanks for the updates! Alexander 2008/10/18 Rich Hickey <[EMAIL PROTECTED]> > > > > On Oct 18, 11:42 am, Alexander Kjeldaas <[EMAIL PROTECTED]> > wrote: > > The following fails for me: > > > > (load-string > >(format "(quote (%s))" > >(nth (iterate #(format "%s%s" % %) "(1 2 3 4)") 1

Re: Newbie question on the use of functional hash maps

2008-10-20 Thread Parth Malwankar
On Oct 20, 6:16 am, "Tom Emerson" <[EMAIL PROTECTED]> wrote: > Hi all, > > I have a somewhat embarassing newbie question on the use of hash maps > in a functional environment. > > Consider a little utility that counts the number of unique words in a > file. A hash map mapping strings to integers

Re: Suggestions on handling state for a game...

2008-10-20 Thread Parth Malwankar
On Oct 20, 1:38 am, Adam Jones <[EMAIL PROTECTED]> wrote: > I'm starting up work again on my Clojure-based game. Up until this > point I've been doing things the "dirty" way by re-defing a bunch of > global variables and/or storing the values in the Java objects I need > to use to get access to

(in-ns 'foo) support for clj buffers in slime.

2008-10-20 Thread Luke Hope
Hi all, Adding the below to your .emacs will make slime change packages correctly according to (in-ns 'foo). All I did was alter slime-search-buffer-package in slime.el to create slime-search-buffer-package-clojure. The standard common-lisp patterns are still valid. Something like this could g

Re: Swank-clojure: slime-eval-print-last-expression failing.

2008-10-20 Thread Luke Hope
After some hacking and a little help from #clojure, here is my initial gift to the community: Add the following function definition to swank-clojure/swank/commands/basic/basic.clj to get C-j working in *slime-scratch*. (in-ns 'swank.commands.basic) ;; optional, only if you have the below functio