ANN: 26 October Overtone Orchestra in London

2011-10-20 Thread Bruce Durling
Hello Fellow Clojurians and Clojure Curious! Following from Sam Aaron's very well received talk on Making Music with Clojure using Overtone the London Clojure Dojo is holding a special Clojure Dojo on Wednesday 26 October where we'll be having fun making music with Overtone. Sign up for the

Re: Is there a reader setting support BigDecimal by default?

2011-10-20 Thread Joel Gluth
On Tue, Oct 18, 2011 at 3:47 PM, Tassilo Horn tass...@member.fsf.org wrote: Scott Hickey jscotthic...@gmail.com writes: And usually, you should refrain from using floating points at all, no matter if BigDecimal or Double. I thought BigDecimal with was not a floating point in the traditional

Re: Clojure 1.3 treatment of integers and longs

2011-10-20 Thread nathanmarz
Yes, I understand the behavior perfectly well. The primitive int gets converted to a Long immediately, as this code demonstrates: user= (class (Integer/parseInt 5)) java.lang.Long The int isn't being boxed into a Long -- the type is being changed. I'm aware that I can fix things by converting

Re: Is there a reader setting support BigDecimal by default?

2011-10-20 Thread Ben Smith-Mannschott
On Thu, Oct 20, 2011 at 11:17, Joel Gluth joel.gl...@gmail.com wrote: On Tue, Oct 18, 2011 at 3:47 PM, Tassilo Horn tass...@member.fsf.org wrote: Scott Hickey jscotthic...@gmail.com writes: And usually, you should refrain from using floating points at all, no matter if BigDecimal or Double.

Re: About metadat and #^ macro.

2011-10-20 Thread Chris Perkins
Alan, I'm with you on this one. Reflection is so much slower that sometimes I wish clojure had a different syntax for reflective method invocation. For example: 1) Make reflection an automatic error (not even a warning), and 2) Use another syntax (let's say double-dot, for the sake of

Re: Is there a reader setting support BigDecimal by default?

2011-10-20 Thread Tassilo Horn
Joel Gluth joel.gl...@gmail.com writes: And usually, you should refrain from using floating points at all, no matter if BigDecimal or Double. I thought BigDecimal with was not a floating point in the traditional sense (ie., subject to all of the usual rounding horror, unless you ask it to

Re: About metadat and #^ macro.

2011-10-20 Thread Baishampayan Ghose
On Thu, Oct 20, 2011 at 3:53 PM, Chris Perkins chrisperkin...@gmail.com wrote: 1) Make reflection an automatic error (not even a warning), and 2) Use another syntax (let's say double-dot, for the sake of argument) to mean I'm OK with this being done via reflection. (.foo bar)  = error (.foo

Re: Type hints and records

2011-10-20 Thread Chris Perkins
Tangentially: In this particular case, reflection isn't strictly necessary because toString is a method of Object. In theory, the compiler could special-case Object's methods and never do reflection, right? In practice, I don't know if it's worth the effort, although it's certainly a little

clojure starter package for aichallenge ?

2011-10-20 Thread faenvie
hi clojure community, at the moment there seems to be no applicable clojure starter package for the http://aichallenge.org/ though some work has be done on it by chris granger, i think: https://github.com/ibdknox/aichallenge are there any plans to get a clojure starter package out ? it would be

Array type hints in 1.3

2011-10-20 Thread Herwig Hochleitner
Hi, definterface has the ability to type methods. http://dev.clojure.org/jira/browse/CLJ-737 and its attached patch http://dev.clojure.org/jira/secure/attachment/10119/definterface-array-fix-with-tests.patch suggest, that you should be able specify array types too. When I tried it (in 1.3),

Re: Clojure 1.3 treatment of integers and longs

2011-10-20 Thread Stuart Halloway
Yes, I understand the behavior perfectly well. The primitive int gets converted to a Long immediately, as this code demonstrates: user= (class (Integer/parseInt 5)) java.lang.Long The int isn't being boxed into a Long -- the type is being changed. I'm aware that I can fix things by

Re: About metadat and #^ macro.

2011-10-20 Thread Luc Prefontaine
Hey guys, The small loss of performance expression was applied to the specific example I used to illustrate the thing. 500 times longer may look huge but if it occurs 10 times in your application run, bottom line it may mean nothing. Of course if you have a fn chewing up 30% of your application

Re: Clojure 1.3 treatment of integers and longs

2011-10-20 Thread Luc Prefontaine
We still have a sizable Java chunk here closely interacting with Clojure and fully agree with #1 and #2. Interop is environment specific and should not be driving the Clojure language design. Otherwise Clojure generics would have to bend to Java, CLR, JS and future implementations in other

Re: Type hints and records

2011-10-20 Thread Casper Clausen
Thanks for the clarification. Just to clear up any confusion, the .toString example was just the simplest example I could think of that illustrated was I was seeing with regards to reflection and type hints :) On Oct 20, 4:22 am, Michael Fogus mefo...@gmail.com wrote: Another potential option

Rich Hickey: Simple Made Easy from Strange Loop 2011

2011-10-20 Thread Alex Miller
The video is up: http://www.infoq.com/presentations/Simple-Made-Easy Places to watch for comments (or vote if you like): - http://news.ycombinator.com/item?id=3135185 - http://www.reddit.com/r/programming/comments/lirke/simple_made_easy_by_rich_hickey_video/ -

Re: Clojure 1.3 treatment of integers and longs

2011-10-20 Thread Kevin Downey
On Thu, Oct 20, 2011 at 1:54 AM, nathanmarz nathan.m...@gmail.com wrote: Yes, I understand the behavior perfectly well. The primitive int gets converted to a Long immediately, as this code demonstrates: user= (class (Integer/parseInt 5)) java.lang.Long class is a clojure function that takes

Re: Will clojurescript get in-ns and load?

2011-10-20 Thread Dave Sann
Good point. Let me change the question slightly, Is there a compile time capability that will allow namespaces to be split across several files and merged. Thereby achieving the equivalent of in-ns and load? Basically, I would like to have a namespace where some functions are defined in a

Re: Will clojurescript get in-ns and load?

2011-10-20 Thread Dave Sann
Thinking further, the capability would not be of use (to me) if it were not consistent/indistinguishable across clojure and clojurescript. I have seen in-ns and load used to effectively split a namespace across files If 'in-ns' and 'load' were implemented for clojurescript, could 'load' be

Re: Clojure 1.3 treatment of integers and longs

2011-10-20 Thread Justin Kramer
Here's a quick proof using an interface-based primitive detector: (definterface IPrimitiveTester (getType [^int x]) (getType [^long x]) ;; other types elided ) (deftype PrimitiveTester [] IPrimitiveTester (getType [this ^int x] :int) (getType [this ^long x] :long) ;; other types

Re: Clojure 1.3 treatment of integers and longs

2011-10-20 Thread Justin Kramer
Oops, I elided a little too much. Need a method with an Object signature to distinguish Integer from int: (definterface IPrimitiveTester (getType [^int x]) (getType [^long x]) ;; etc (getType [^Object x])) (deftype PrimitiveTester [] IPrimitiveTester (getType [this ^int x] :int)

Clojure 1.3 wonky behavior

2011-10-20 Thread Micah Martin
I recently tried to get Speclj running on Clojure 1.3 and came across the following problem: (list (declare ^:dynamic p) (defn q [] @p)) (binding [p (atom 10)] (q)) java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to clojure.lang.IDeref Thanks to @cemerick for

Re: Rich Hickey: Simple Made Easy from Strange Loop 2011

2011-10-20 Thread daly
In the Simple-Made-Easy talk Rich raises the question of long term use. In particular, he mentions the issue of maintenance and change. In order to change software you need to understand the program. Unfortunately most people equate understanding the program as being equivalent to what the

Question:Multi-Core processor affinity for load balancing Clojure Web apps

2011-10-20 Thread Tim Robinson
This may not be a Clojure specific kind of question, but this is for my Clojure web app(s) so hopefully it's not too far off. Currently when I deploy my web apps I run 1 app instance on 1 app server. Given these are multi-core servers I am thinking about running 4 app instances on a server to get

Re: Rich Hickey: Simple Made Easy from Strange Loop 2011

2011-10-20 Thread Timothy Baldridge
As a person currently suffering under the load of a highly entangled system here at work, I really appreciated this talk. The software I'm currently working on is so entangled, so strongly typed, that we have some parts of our app even our Architect doesn't want to touch. It's almost as if Rich

Re: Clojure 1.3 wonky behavior

2011-10-20 Thread Meikel Brandmeyer
Hi, Am 20.10.2011 um 19:53 schrieb Micah Martin: I recently tried to get Speclj running on Clojure 1.3 and came across the following problem: (list (declare ^:dynamic p) (defn q [] @p)) (binding [p (atom 10)] (q)) java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be

Re: Clojure 1.3 treatment of integers and longs

2011-10-20 Thread nathanmarz
Thanks, that clarifies the behavior. Regardless though, at some point the int is becoming a Long which is a change of type. I'm arguing that Clojure should box primitive ints as Longs. Stu, I wouldn't say Clojure's behavior makes it just work. For example, if I obtained by number using

Re: Clojure 1.3 treatment of integers and longs

2011-10-20 Thread nathanmarz
Oops, I meant Clojure should box primitive ints as Integers. :-) On Oct 20, 12:15 pm, nathanmarz nathan.m...@gmail.com wrote: Thanks, that clarifies the behavior. Regardless though, at some point the int is becoming a Long which is a change of type. I'm arguing that Clojure should box

Re: Clojure 1.3 treatment of integers and longs

2011-10-20 Thread David Nolen
Such a change would be make Clojure's numeric design inconsistent. You keep saying that Clojure is changing the types - that's probably not the right way to look at it. It's a semantic change, Clojure now only has 64bit primitives - the same way that JavaScript only has doubles. Prior to the 1.3

Re: Question:Multi-Core processor affinity for load balancing Clojure Web apps

2011-10-20 Thread Colin Yates
I don't think so. Jetty is also multi-threaded; each request will be served by a new thread (within a bounded thread pool). Secondly, processor affinity is almost always a bad idea; the OS is pretty good at doing this for you. At the very least I would have a test harness which measures the

Re: Clojure 1.3 treatment of integers and longs

2011-10-20 Thread nathanmarz
But Clojure is already inconsistent. ints and Integers in interop are treated differently. The only way to make Clojure consistent is to either: 1. Box ints as Integers 2. Always convert Integers to Longs. I'm not sure on the feasibility of #2. I'm not trying to be obtuse, but I really don't

Re: Clojure 1.3 treatment of integers and longs

2011-10-20 Thread David Nolen
On Thu, Oct 20, 2011 at 3:45 PM, nathanmarz nathan.m...@gmail.com wrote: But Clojure is already inconsistent. ints and Integers in interop are treated differently. The only way to make Clojure consistent is to either: Clojure is consistent. Whether or not that makes *interop* easier or

Re: Clojure 1.3 treatment of integers and longs

2011-10-20 Thread Kevin Downey
On Thu, Oct 20, 2011 at 12:45 PM, nathanmarz nathan.m...@gmail.com wrote: But Clojure is already inconsistent. ints and Integers in interop are treated differently. The only way to make Clojure consistent is to either: as David said Clojure now only has 64bit primitives. an Integer is not a

Re: Clojure 1.3 treatment of integers and longs

2011-10-20 Thread nathanmarz
I'm not sure we're arguing about the same thing. I think that Clojure only supporting 64 bit primitive arithmetic is fine, and I'm not proposing that it support 32 bit primitive arithmetic. The sole point of contention is what Clojure does when it has to box a primitive int. I think this is

Re: Clojure 1.3 wonky behavior

2011-10-20 Thread Chris Perkins
To put it another way: a top-level do is special-cased to compile and then immediately execute each contained form, in order. Any other top-level form, such as list, will be fully compiled, including all contained forms, and only then executed. In this case, the defn cannot compile because the

Re: Clojure 1.3 wonky behavior

2011-10-20 Thread Chris Perkins
Note: I forgot to preface that with I think... :) Upon experimenting briefly, it turns out I was wrong about how Clojure works (that seems to happen a lot with me). A declare/def defines a var even when it's not executed! user (defn xxx [] (declare yyy)) #'user/xxx user yyy #Unbound Unbound:

Re: Is there a reader setting support BigDecimal by default?

2011-10-20 Thread Scott Hickey
Thank for the replies and I appreciate the suggestions, however they some of the rationale behind them doesn't match well my experience. First, BigDecimal is plenty fast the large business systems I've worked on. Actually, it has been plenty fast for every large business system I've worked on.

Re: Is there a reader setting support BigDecimal by default?

2011-10-20 Thread Stuart Sierra
Scott: no, there is no way to configure the reader to default numbers with a decimal point to be BigDecimal instead of Double Correct. But you can modify the Reader: it's just Java code. -S -- You received this message because you are subscribed to the Google Groups Clojure group. To post to

Re: Is there a reader setting support BigDecimal by default?

2011-10-20 Thread Stuart Halloway
It appears that the answer to the original question is no, there is no way to configure the reader to default numbers with a decimal point to be BigDecimal instead of Double. Scott Hickey Reading a double implies that somebody upstream of you was using doubles, which violates the

Re: Is there a reader setting support BigDecimal by default?

2011-10-20 Thread Ben Smith-Mannschott
On Thu, Oct 20, 2011 at 22:50, Stuart Halloway stuart.hallo...@gmail.com wrote: It appears that the answer to the original question is no, there is no way to configure the reader to default numbers with a decimal point to be BigDecimal instead of Double. Scott Hickey Reading a double

Re: Is there a reader setting support BigDecimal by default?

2011-10-20 Thread Stuart Halloway
It appears that the answer to the original question is no, there is no way to configure the reader to default numbers with a decimal point to be BigDecimal instead of Double. Scott Hickey Reading a double implies that somebody upstream of you was using doubles, which violates the

Re: Is there a reader setting support BigDecimal by default?

2011-10-20 Thread Ben Smith-Mannschott
On Thu, Oct 20, 2011 at 23:16, Stuart Halloway stuart.hallo...@gmail.com wrote: It appears that the answer to the original question is no, there is no way to configure the reader to default numbers with a decimal point to be BigDecimal instead of Double. Scott Hickey Reading a double

Re: Clojure 1.3 wonky behavior

2011-10-20 Thread Chouser
On Thu, Oct 20, 2011 at 4:31 PM, Chris Perkins chrisperkin...@gmail.com wrote: Note: I forgot to preface that with I think... :)  Upon experimenting briefly, it turns out I was wrong about how Clojure works (that seems to happen a lot with me).  A declare/def defines a var even when it's not

Finding a function's expected argument list length

2011-10-20 Thread Alex Baranosky
For some work I'm doing it would be very nice to be able to know the number of arguments any given function expects to be called with. Is there anyway to get this information at run-time in Clojure? Thanks. -- You received this message because you are subscribed to the Google Groups Clojure

Re: Clojure 1.3 treatment of integers and longs

2011-10-20 Thread Sean Corfield
On Thu, Oct 20, 2011 at 1:11 PM, nathanmarz nathan.m...@gmail.com wrote: of contention is what Clojure does when it has to box a primitive int. My understanding is that Clojure 1.3 has 64-bit primitives, i.e., longs and double. You only have a primitive int if you coerce the value to int (for an

Re: Clojure 1.3 treatment of integers and longs

2011-10-20 Thread Luc Prefontaine
So you propose this: user= (time (dotimes [i 1000] (let [ a (Integer. 1) b (Integer. 2)] (+ a b Elapsed time: 31.14886 msecs nil Instead of this: user= (time (dotimes [i 1000] (let [ a 1 b 2] (+ a b Elapsed time: 15.680386 msecs nil Using a wrapper instead of a primitive type

Re: Will clojurescript get in-ns and load?

2011-10-20 Thread Scott Jaderholm
There is a load-file function in clojurescript, I'm guessing that doesn't do what you want? Scott On Thu, Oct 20, 2011 at 1:07 PM, Dave Sann daves...@gmail.com wrote: Thinking further, the capability would not be of use (to me) if it were not consistent/indistinguishable across clojure and

partial, but instead of args + additional, get additional + args

2011-10-20 Thread Wilker
Hi guys, I fall out in many situations that I want the partial, but inversed, a simple example: Let's say I wanna all primes bellow 2.000: (take-while (partial 2000) primes) In this case, that's ok, but I don't expressed myself write, I because I had to use the oposite of to create the

Re: Rich Hickey: Simple Made Easy from Strange Loop 2011

2011-10-20 Thread mmwaikar
I can understand your situation because I've seen a C# code where most of the classes in some 5-6 different assemblies had all (or 90%) static methods :) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Clojure jar files.

2011-10-20 Thread mmwaikar
Clojure.jar does not have a project.clj file because it is all java code, right? If it is all java code then it's a (java) jar file. I found this convention of bundling a clojure jar file with a project.clj file - lein does this and that's all I know - so I was curious to know if every other

Re: Finding a function's expected argument list length

2011-10-20 Thread Alan Malloy
No. The summary is: from Java's point of view every function is willing to accept any number of args, but many of the implementations throw an exception. Vars have an :arglists metadata key, but that is not generally present on functions. I agree it would be nice if function objects carried a set

Re: Finding a function's expected argument list length

2011-10-20 Thread mmwaikar
In a REPL, user (defn hello [name] (println hi, name)) #'user/hello user (meta (var hello)) {:ns #Namespace user, :name hello, :file NO_SOURCE_FILE, :line 1, :arglists ([name])} Please also check - http://clojuredocs.org/clojure_core/clojure.core/meta -- You received this message

Re: Clojure jar files.

2011-10-20 Thread Baishampayan Ghose
Manoj, On Fri, Oct 21, 2011 at 9:09 AM, mmwaikar mmwai...@gmail.com wrote: Clojure.jar does not have a project.clj file because it is all java code, right? If it is all java code then it's a (java) jar file. I found this convention of bundling a clojure jar file with a project.clj file -

Re: Finding a function's expected argument list length

2011-10-20 Thread Alex Baranosky
I figured, but had to ask. I'm looking into adding a feature to Midje to be able to say: (defn g [a b c d e f g] nil) (fact (f 1) = 1 (provided (g ...) :never )) instead of what you currently have to say for the equivalent: (fact (f 1) = 1 (provided (g anything anything

Re: partial, but instead of args + additional, get additional + args

2011-10-20 Thread Sean Corfield
On Thu, Oct 20, 2011 at 8:15 PM, Wilker wilkerlu...@gmail.com wrote: In the case of it's ok because they are reverse of each other, but in some circustances there is no reverse function, and you finish can't be using partial, instead you do like: (take-while #( % 2000) primes) I mean,

Re: Finding a function's expected argument list length

2011-10-20 Thread Alex Baranosky
Thanks. I'm going to have to see if that could help with what I'm trying to do. On Thu, Oct 20, 2011 at 11:45 PM, mmwaikar mmwai...@gmail.com wrote: In a REPL, user (defn hello [name] (println hi, name)) #'user/hello user (meta (var hello)) {:ns #Namespace user, :name hello,

Re: partial, but instead of args + additional, get additional + args

2011-10-20 Thread Meikel Brandmeyer
Hi, Am 21.10.2011 um 06:01 schrieb Sean Corfield: On Thu, Oct 20, 2011 at 8:15 PM, Wilker wilkerlu...@gmail.com wrote: (take-while #( % 2000) primes) I was expressing a need for exactly this function the other day on IRC. I jokingly called it 'impartial' :) What is bad about #( % 2000)?

Re: Clojure 1.3 treatment of integers and longs

2011-10-20 Thread nathanmarz
Now I'm confused. So when I do this: (def i (Integer/parseInt 1)) Is i a primitive int, a primitive long, or a Long object? I was under the impression that it was a primitive int based on Justin's test code, but when I run (primitive-type i) in the REPL it tells me :object. If i is a primitive

Re: partial, but instead of args + additional, get additional + args

2011-10-20 Thread Wilker
Hi Miekel, The main reason is because I feel it is more expressive, and I really love expressive code :) --- Wilker Lúcio http://about.me/wilkerlucio/bio Kajabi Consultant +55 81 82556600 On Thu, Oct 20, 2011 at 9:10 PM, Meikel Brandmeyer m...@kotka.de wrote: Hi, Am 21.10.2011 um 06:01

Re: Clojure 1.3 treatment of integers and longs

2011-10-20 Thread Alan Malloy
It is a Long object. Vars hold objects, so it has to be boxed. However, if instead of def'ing it you immediately called some java method that will accept either a primitive int or a primitive long, my understanding is that Clojure would arrange for the int version to be called, because no boxing

Re: Clojure 1.3 treatment of integers and longs

2011-10-20 Thread nathanmarz
Thanks Alan, that makes sense. This code example illustrates that Clojure values can already be primitive ints: user= (let [i 1] (primitive-type i)) :long user= (let [i (Integer/parseInt 1)] (primitive-type i)) :int So it appears that Clojure's behavior is case #2 from my last comment. All I'm

Re: About metadat and #^ macro.

2011-10-20 Thread mmwaikar
Thanks everyone for your inputs and the discussion. Manoj. -- 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 patient with your

Re: Clojure 1.3 treatment of integers and longs

2011-10-20 Thread Luc Prefontaine
The weirdness here is that you seem to confuse the Java context and the Clojure context. They are not the same. Clojure has to satisfy to performance and consistency criterias. It's a language of it's own, not a Java offspring. user= (class (Integer/parseInt 1)) java.lang.Long user=