Re: Long as keys in hash-map

2010-05-20 Thread Mibu
Jason, this was very helpful. sorted-map's correct behavior compared to the naive behavior of hash-map is what confused me. Thanks for clearing this up. On May 21, 6:31 am, Jason Wolfe wrote: > The crux of the issue: > > user> (= (long 1) (int 1)) > true > user> (.equals (long 1) (int 1)) > fals

Re: Long as keys in hash-map

2010-05-20 Thread Adrian Cuthbertson
On Fri, May 21, 2010 at 4:57 AM, Mibu wrote: > I tried to use Long keys from the java.io.File/length method in a hash- > map and failed to retrieve values using them. sorted-map is fine. The > doc says hash-maps require keys that support .equals and .hashCode. > Doesn't Long support those or am I

Re: Long as keys in hash-map

2010-05-20 Thread Jason Wolfe
The crux of the issue: user> (= (long 1) (int 1)) true user> (.equals (long 1) (int 1)) false user> (.equals (int 1) 1) true user> (.equals (long 1) 1) false So, as you can see, small integer literals are Integers by default in Clojure. And, while Integers and Longs with the same value are Cloju

Re: Long as keys in hash-map

2010-05-20 Thread MarkSwanson
On May 20, 10:57 pm, Mibu wrote: > I tried to use Long keys from the java.io.File/length method in a hash- > map and failed to retrieve values using them. sorted-map is fine. The > doc says hash-maps require keys that support .equals and .hashCode. > Doesn't Long support those or am I missing so

Long as keys in hash-map

2010-05-20 Thread Mibu
I tried to use Long keys from the java.io.File/length method in a hash- map and failed to retrieve values using them. sorted-map is fine. The doc says hash-maps require keys that support .equals and .hashCode. Doesn't Long support those or am I missing something else? -- You received this message

Re: Clojure on Android

2010-05-20 Thread Mike Meyer
[Format recovered from top posting. > On Thu, May 20, 2010 at 3:21 PM, rob levy wrote: > > On Thu, May 20, 2010 at 12:37 PM, David Blubaugh < > > davidblubaugh2...@gmail.com> wrote: > >> Has anyone yet ported clojure to the android cellphones at this > >> time ?? I want to develop applications f

Re: Running Clojure scripts in Maven

2010-05-20 Thread Jason Smith
Now that I've had more time to think about it, I think your original idea should be the default, and only, behavior. Scripts should be able to access dependencies of the project, and, if possible, the compiled project classes as well (available after they are compiled). The code I checked into /tr

Re: Clojure on Android

2010-05-20 Thread rob levy
Also see the tutorial: http://riddell.us/ClojureAndAndroidWithEmacsOnUbuntu.html On Thu, May 20, 2010 at 3:21 PM, rob levy wrote: > Hi David, > > Check-out http://github.com/remvee/clojurehelloandroid > > I'm surprised we don't hear more talk of people doing this. It's on my > list of things to

Re: Clojure on Android

2010-05-20 Thread rob levy
Hi David, Check-out http://github.com/remvee/clojurehelloandroid I'm surprised we don't hear more talk of people doing this. It's on my list of things to do too (I just got an mp3 player that runs Android 1.6 and I'm going to start with Remvee's Hello World example). Rob On Thu, May 20, 2010 a

Clojure on Android

2010-05-20 Thread David Blubaugh
To All, Has anyone yet ported clojure to the android cellphones at this time ?? I want to develop applications for the Android cellphones by utilizing a dialect of the lisp programming language David -- You received this message because you are subscribed to the Google Groups "Clojure" grou

Accessing final methods of superclass using :gen-class

2010-05-20 Thread Edmund
Hello, I'm attempting to use some java classes in clojure, where I need the clojure to be AOT compiled. I'm running into trouble with accessing final methods in the superclass of genclass. Some code: --= Hello.java = package com.example; public class Hello { publi

Re: functional check slower than imperative?

2010-05-20 Thread Christophe Grand
On Wed, May 19, 2010 at 7:13 PM, braver wrote: > On May 18, 11:45 am, Christophe Grand wrote: > > (defn sorted-by? [pred s] > > (if-let [ns (next s)] > > (let [[a b] s] > > (and (pred a b) (recur pred ns))) > > true)) > > > (defn reps-sorted2? [dreps] > > (every? #(sorted-by? >=

Re: Strange protocol behaviour

2010-05-20 Thread Steve Purcell
Before anyone spends time investigating, this has been accepted as an issue: https://www.assembla.com/spaces/clojure/support/tickets/353 My workaround for now is to use reify in place of deftype. -Steve On 20 May 2010, at 13:43, Steve Purcell wrote: > I'm loving protocols, but I keep having

Re: Running Clojure scripts in Maven

2010-05-20 Thread Geoff
How about two separate maven goals? One "script" goal that does the current behaviour and shares vars, and one "execute" goal that can run code from the project. I imagine the "execute" goal would usually be used to call a single function in the clj source files. To simply support this, the goal co

Re: agents returning nil by default

2010-05-20 Thread Anders Rune Jensen
On Thu, May 20, 2010 at 2:26 PM, Daniel Werner wrote: > On 20 May 2010 11:42, Anders Rune Jensen wrote: >> The algorithm: >> >> (defn change-state [cur-state] >>   (when (> (:value cur-state) 10) >>      (assoc cur-state :message "danger, danger"))) >> >> How I'd have to write it when using an ag

Strange protocol behaviour

2010-05-20 Thread Steve Purcell
I'm loving protocols, but I keep having to restart my JVM to avoid a puzzling issue when changing protocol definitions. Here's the simplest way to reproduce the problem: Start with file protoproblem/proto.clj: (ns protoproblem.proto) (defprotocol Steps (one [x]) (two [x]))

Re: agents returning nil by default

2010-05-20 Thread Daniel Werner
On 20 May 2010 11:42, Anders Rune Jensen wrote: > The algorithm: > > (defn change-state [cur-state] >   (when (> (:value cur-state) 10) >      (assoc cur-state :message "danger, danger"))) > > How I'd have to write it when using an agent: > > (defn change-state [cur-state] >   (cond (> (:value cur

Re: Serializable functions?

2010-05-20 Thread Michael Jaaka
Hi! I have found two issues which stops me from using function serializations. (ns code.serialfn (:refer-clojure :exclude (fn))) (defn- save-env [env form] (if env `(let ~(vec (apply concat (for [[name local] env] [name (.eval (.init local))])))

Re: Running Clojure scripts in Maven

2010-05-20 Thread Jason Smith
Tracking this issue at http://code.google.com/p/sandflea/issues/detail?id=2 -- 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 patien

Re: Running Clojure scripts in Maven

2010-05-20 Thread Jason Smith
Okay, yes, what you are asking is possible, and I know how to do it. Of course, to see the compiled artifacts on the classpath, you'll have to be running in a state that runs after they have been created. :-) This shouldn't be terribly hard to do, but it's a bit arcane. I'll see if I can make it

Re: swank-clojure and GNU Emacs 23 - package.el install issues

2010-05-20 Thread doug smith
this may help: http://www.bestinclass.dk/index.clj/2009/12/clojure-101-getting-clojure-slime-installed.html -doug On May 17, 4:18 pm, Terrence Brannon wrote: > Hello, I wanted to try out Clojure. It was my understanding that > swank-clojure was a package GNU Emacs that would download clojure >

Re: Simlpe style question

2010-05-20 Thread Laurent PETIT
edlich, I would be interested in your feedback now that you've read all the different proposed alternatives ? -- 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 membe

Re: agents returning nil by default

2010-05-20 Thread Anders Rune Jensen
On Thu, May 20, 2010 at 10:40 AM, Rasmus Svensson wrote: > 2010/5/10 Anders Rune Jensen >> >> [...] But I was a little surprised to find out that by >> default, if you don't return anything, it will set the value of the >> agent to nil. [...] > > Firstly, all clojure functions always return somet

Re: agents returning nil by default

2010-05-20 Thread Rasmus Svensson
2010/5/10 Anders Rune Jensen > [...] But I was a little surprised to find out that by > default, if you don't return anything, it will set the value of the > agent to nil. [...] > Firstly, all clojure functions always return something. Some forms, such as 'cond' and 'when', return nil as a defau

Re: special forms

2010-05-20 Thread Rasmus Svensson
I thought I'd just share some thoughts on special forms... 2010/5/20 Konrad Hinsen > You can't redefine special forms. What you define in your examples is the > symbols that serve to identify special forms. But they indicate special > forms only when used in the first position of a list that is