Re: slow raw io

2010-06-25 Thread Peter Schuller
I put a self-contained test up here: http://gist.github.com/452095 To run it copy this to slurptest.clj and run these commands java clojure.main slurptest.clj makewords 100 (100 seems good for macs, 300 for linux) java -Xmx3G -Xms3G clojure.main slurptest.clj slurp| slurp2 Trying either

Re: slow raw io

2010-06-25 Thread Peter Schuller
And reading the thread history I realize the problem was already identified (sorry), however: Has anyone else had a chance to try this? I'm surprised to see manual buffering behaving so much better than the BufferedReader implementation but it does seem to make quite a difference. Not really

Re: New Primitive data types (equal branch) - impact on optimized code.

2010-06-25 Thread Heinz N. Gies
On Jun 24, 2010, at 23:17 , David Nolen wrote: Don't have time to dive into this right now, but all I can say is now you are starting to have an idea what the other side looks like. The kind of hoop jumping you have to do get within 3x of Scala is absurd. Yes to see what the other side

Re: Clojure script in the classpath : + Servlet Container Question

2010-06-25 Thread Chas Emerick
Yes, you can load Clojure code from Java and invoke it however you like: RT.var(clojure.core, require).invoke(Symbol.intern(your.namespace.here)); And now you can use your clojure fns: Var myfn = RT.var(your.namespace.here, myfn); myfun.invoke(arg1, arg2, etc); I'd like to have a more

Re: code review request: clojure.java.io

2010-06-25 Thread Chas Emerick
Sorry I'm so late to this particular discussion :-/ Why was to-byte-array left behind? It is a bit of an oddball function, insofar as it doesn't fit into IOFactory or Coercions, but seems to me like a natural cousin to copy. - Chas On May 11, 2010, at 12:16 PM, Stuart Halloway wrote:

Re: Hash-map destructuring

2010-06-25 Thread Chas Emerick
On Jun 16, 2010, at 9:21 PM, Michael Gardner wrote: On Jun 16, 2010, at 7:07 PM, ataggart wrote: There's a disconnect between the function definition and the datastructures used by the caller. Either fix the data structure: (def args [:bar 2 :baz [:quux]]) then use apply Or change the

Re: Commercially-supported, polished Clojure development environment

2010-06-25 Thread Chas Emerick
Sorry, for some reason I thought that the raw data was linked off the 'analytics' page as well -- and then I didn't notice your and Antony's messages looking for that raw data. :-( I've updated the form with a link to the raw data added:

Re: New Primitive data types (equal branch) - impact on optimized code.

2010-06-25 Thread Nicolas Oury
Have you tried manual copying of the perm array (as in the scala version)? It is probably not much better or worse, but it would be nice to have the same algorithm than scala, for comparaison purpose. On Fri, Jun 25, 2010 at 10:10 AM, Heinz N. Gies he...@licenser.net wrote: On Jun 24, 2010,

Re: New Primitive data types (equal branch) - impact on optimized code.

2010-06-25 Thread Martin DeMello
On Fri, Jun 25, 2010 at 8:20 AM, Mark Engelberg mark.engelb...@gmail.com wrote: When exactly did people start expecting Clojure to be as fast as Java and/or Scala? I seem to recall in one of the original Clojure videos, Rich talked about the relationship between Clojure and Java.  There's a

Re: New Primitive data types (equal branch) - impact on optimized code.

2010-06-25 Thread Heinz N. Gies
On Jun 25, 2010, at 12:19 , Nicolas Oury wrote: Have you tried manual copying of the perm array (as in the scala version)? It is probably not much better or worse, but it would be nice to have the same algorithm than scala, for comparaison purpose. Yes the original version did that, the

Re: Clojure Futures Docs and Functionality

2010-06-25 Thread Ryan Senior
Hi Daniel, On Wed, Jun 23, 2010 at 1:15 PM, Daniel Werner daniel.d.wer...@googlemail.com wrote: Judging from previous discussions on this list, I get the feeling that relying too much on the Java implementation details underlying the public Clojure APIs is discouraged. This certainly makes

Re: State of Clojure web development

2010-06-25 Thread Sean Allen
On Wed, Jun 23, 2010 at 5:23 PM, James Reeves weavejes...@googlemail.com wrote: Hello there! Chas Emerick's recent State of Clojure survey [http://bit.ly/dtdAwb] indicated that a significant proportion of Clojure users are beginning to use Clojure for web development. A recent Hacker News

Re: Question about every?

2010-06-25 Thread michele
So the validation takes place after alter messages conj msg in the add-message function? On Jun 24, 4:48 pm, Meikel Brandmeyer m...@kotka.de wrote: Hi, alter calls conj on [] (which is kept as a vector) since it is the initial content of the messages ref. So the content of messages is a

Re: State of Clojure web development

2010-06-25 Thread pavelludiq
1. Have you written, or are you writing, a web application that uses Clojure? What does it do? I've written a few small web apps. 2. Which libraries or frameworks are you using? Which versions? ring and compojure 3. What made you choose Clojure to develop web applications in? What are the

How does contains? work?

2010-06-25 Thread ru
Hello, Explain me this, please: user= (def x (cons 'a nil)) #'user/x user= x (a) user= (contains? x 'a) false user= And, what is Clojure analogue of Lisp member function. Thanks in advance. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to

Duplicate key bug in hash-maps

2010-06-25 Thread Tim Robinson
I tried Clojure via Githhub today. Anyone notice this bug that hadn't existed in Version 1.1 user= #{:item1 {:a A :b B} :item2 {:a A :b B}} java.lang.IllegalArgumentException: Duplicate key: {:a A, :b B} Tim -- You received this message because you are subscribed to the Google Groups Clojure

Re: Duplicate key bug in hash-maps

2010-06-25 Thread Stuart Halloway
Duplicate key prevention is a feature added in commit c733148ba0fb3ff7bbab133f5375422972e62d08. Stu I tried Clojure via Githhub today. Anyone notice this bug that hadn't existed in Version 1.1 user= #{:item1 {:a A :b B} :item2 {:a A :b B}} java.lang.IllegalArgumentException: Duplicate

Re: How does contains? work?

2010-06-25 Thread Meikel Brandmeyer
Hi, (some '#{a} x) or (some #(= 'a %) x) in case 'a can be false or nil. Sincerely Meikel -- 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 -

Re: code review request: clojure.java.io

2010-06-25 Thread Stuart Halloway
No one spoke up for it. Sorry I'm so late to this particular discussion :-/ Why was to-byte-array left behind? It is a bit of an oddball function, insofar as it doesn't fit into IOFactory or Coercions, but seems to me like a natural cousin to copy. - Chas On May 11, 2010, at 12:16

Re: Question about every?

2010-06-25 Thread Meikel Brandmeyer
Hi, On Jun 25, 8:12 am, michele michelemen...@gmail.com wrote: So the validation takes place after alter messages conj msg in the add-message function? Well. in between. It takes place after the conj, but before the alter. The value is taken from the ref and modified by the function you

Re: How does contains? work?

2010-06-25 Thread Meikel Brandmeyer
BTW: Searching the group archives for contains? will bring up a lot of information on this topic. -- 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

Re: slow raw io

2010-06-25 Thread Stuart Halloway
Hi Peter, You are on the contributors list, so I just need to know your account name on Assembla to activate your ability to add tickets, patches, etc. Let me know your account name (which needs to be some permutation of your real name, not a nick). Thanks, Stu I put a self-contained test

Re: How does contains? work?

2010-06-25 Thread Peter Schuller
Explain me this, please: user= (def x (cons 'a nil)) #'user/x user= x (a) user= (contains? x 'a) false user= contains? checks whether the collection contains the *key*, not the value. So for example the list [:a :b] contains keys 0 and 1, but not 2 or :a: user= (contains? [:a :b] 0)

Re: slow raw io

2010-06-25 Thread Peter Schuller
You are on the contributors list, so I just need to know your account name on Assembla to activate your ability to add tickets, patches, etc. Let me know your account name (which needs to be some permutation of  your real name, not a nick). When I read up before submitting the contributor

Re: slow raw io

2010-06-25 Thread Peter Schuller
I can register another account (no problem), but what implications are there on the fact that I wrote 'scode' on the contributor agreement I mail:ed Rich? I just registered peterschuller. -- / Peter Schuller -- You received this message because you are subscribed to the Google Groups

Re: New Primitive data types (equal branch) - impact on optimized code.

2010-06-25 Thread Nicolas Oury
could you also give more info of the jvm/flags you use. Especially I see you are on a mac where last time I checked the default was the client HotSpot. On Fri, Jun 25, 2010 at 12:18 PM, Heinz N. Gies he...@licenser.net wrote: On Jun 25, 2010, at 12:19 , Nicolas Oury wrote: Have you tried

Re: State of Clojure web development

2010-06-25 Thread martin_clausen
Regarding deployment leiningen-war might prove useful http://github.com/alienscience/leiningen-war. On Jun 24, 7:17 pm, Brenton bashw...@gmail.com wrote: 1. Have you written, or are you writing, a web application that uses Clojure? What does it do? I am an independent contractor and do a lot

Re: Duplicate key bug in hash-maps

2010-06-25 Thread Michael Wood
On 25 June 2010 12:27, Tim Robinson tim.blacks...@gmail.com wrote: I tried Clojure via Githhub today. Anyone notice this bug that hadn't existed in Version 1.1 user= #{:item1 {:a A :b B} :item2 {:a A :b B}} java.lang.IllegalArgumentException: Duplicate key: {:a A, :b B} You're trying to put

Re: Duplicate key bug in hash-maps

2010-06-25 Thread Mike Meyer
On Fri, 25 Jun 2010 15:36:31 +0200 Michael Wood esiot...@gmail.com wrote: On 25 June 2010 12:27, Tim Robinson tim.blacks...@gmail.com wrote: I tried Clojure via Githhub today. Anyone notice this bug that hadn't existed in Version 1.1 user= #{:item1 {:a A :b B} :item2 {:a A :b B}}

Re: Duplicate key bug in hash-maps

2010-06-25 Thread Daniel Gagnon
Apparently, duplicate keys in sets are only disallowed in set literals. Arguably, that must be a mistake on the users part, but it sure seems to clash with the behavior of sets elsewhere. Why would you ever want to write a duplicate in a set literal? -- You received this message because

Re: Duplicate key bug in hash-maps

2010-06-25 Thread Stuart Halloway
Duplicate keys in maps/sets are disallowed in literals and factory functions, where data is generally literal inline and therefore likely represents coder error: ; all disallowed #{:a :a} {:a 1 :a 2} (hash-map :a 1 :a 2) (hash-set :a :a) They are allowed in other contexts, where the data

Re: State of Clojure web development

2010-06-25 Thread Luc Préfontaine
Were not using Clojure yet for our Web based GUIs. The main reason being that we jumped on Rails last year. Most of our needs are to display/edit database data and the ActiveScaffold plugin allows us to write a controller in 20 lines. We do not need to write forms, it's all done through partial

Re: slow raw io

2010-06-25 Thread cageface
Thanks Stuart Peter for following up on this. Now I can get back to plowing through this mountain of ldiff data with Clojure! -- 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

Re: Duplicate key bug in hash-maps

2010-06-25 Thread Mike Meyer
On Fri, 25 Jun 2010 10:31:57 -0400 Stuart Halloway stuart.hallo...@gmail.com wrote: Duplicate keys in maps/sets are disallowed in literals and factory functions, where data is generally literal inline and therefore likely represents coder error: ; all disallowed #{:a :a} {:a 1 :a 2}

Re: Duplicate key bug in hash-maps

2010-06-25 Thread Stuart Halloway
I think there are two important considerations in favor of how it works now: (1) The common case presumptions (which admittedly may need to be learned). (2) The need for both flavors. If there wasn't a flavor that rejected duplicate keys, somebody would surely ask for it. Add to these

Re: Duplicate key bug in hash-maps

2010-06-25 Thread Mike Meyer
On Fri, 25 Jun 2010 11:37:32 -0400 Stuart Halloway stuart.hallo...@gmail.com wrote: (2) The need for both flavors. If there wasn't a flavor that rejected duplicate keys, somebody would surely ask for it. I guess it makes as much sense as anything, given that you don't want to get into -unique

Re: Hash-map destructuring

2010-06-25 Thread Brian Carper
On Jun 25, 2:57 am, Chas Emerick cemer...@snowtide.com wrote: This is fairly simple: user= (defn foo [ {:as args}] [args]) #'user/foo user= (def m {:a 5 :b 6}) #'user/m user= (apply foo (- m seq flatten)) [{:a 5, :b 6}] I'm not sure if it could be made easier, short of changing apply  

Re: Hash-map destructuring

2010-06-25 Thread David Nolen
On Wed, Jun 16, 2010 at 7:00 PM, Brian Carper briancar...@gmail.com wrote: Given: (defn foo [x {:as args}] [x args]) (foo 1 :bar 2 :baz [:quux]) = [1 {:bar 2, :baz [:quux]}] If I have those rest-arguments already in a map, what's the most elegant way to call foo with them? (def args

Re: State of Clojure web development

2010-06-25 Thread Mark Engelberg
On 2010-06-24, at 12:27, Daniel Gagnon redalas...@gmail.com wrote: I don't use Clojure for web development and I thought sharing why could be useful too. For web development, my favourite tool is Django. It comes as a fullstack framework which means I have everything I need out of the box.

Re: How does contains? work?

2010-06-25 Thread ataggart
My sense from reading Rich's writing on the subject is that 'contains? was named with the use of sets in mind. There is also a pairing logic involved whereby if 'contains? returns true, the the value returned by 'get is valid (this covers cases in maps where the value actually is nil). As Meikel

Re: Clojure Futures Docs and Functionality

2010-06-25 Thread Daniel Werner
On 25 June 2010 05:27, Ryan Senior senior.r...@gmail.com wrote: (future-await fut2 2 :minutes) ; = done Your implementation points into the right direction (again, IMHO). I'd like to offer two suggestions: 1. Leave out the three-arg version of future-await. The time unit conversion seems

Enhanced primitive support - redux

2010-06-25 Thread Rich Hickey
equiv, the revenge of num The latest revision of primitive support is in the equiv branch. It takes the approach of num, with no auto-promotion, and bigint contagion, and adds several things to better support contagion. I think contagion is the best way to continue to support polymorphic

Re: Enhanced primitive support - redux

2010-06-25 Thread Garth Sheldon-Coulson
This looks excellent. I'd like to re-raise a question I had a few days ago: Will this ultimately come to affect floats, too? In particular: 1) If there is going to be BigInt contagion, why not BigDecimal contagion? user= (* 4 5) 20 user= (* 4 5N) 20N but user= (* 4.0 5.0) 20.0 user= (* 4.0

Re: Enhanced primitive support - redux

2010-06-25 Thread Nicolas Oury
Amazingly good ideas. Will try it tomorrow. On Fri, Jun 25, 2010 at 8:04 PM, Rich Hickey richhic...@gmail.com wrote: equiv, the revenge of num The latest revision of primitive support is in the equiv branch. It takes the approach of num, with no auto-promotion, and bigint contagion, and adds

Re: Enhanced primitive support - redux

2010-06-25 Thread Garth Sheldon-Coulson
Following up, point (2) in my previous message would be helpful only if = were changed so that it looked at the stripTrailingZeros() value of BigDecimals. I would advocate this in any case, because the following behavior appears silly to me (is it useful to anyone?): user= (== 434343.00M

Re: Enhanced primitive support - redux

2010-06-25 Thread Mark Engelberg
floats and doubles are inexact numbers and ratios, ints, longs, bigints, and bigdecimals are exact numbers. The expected behavior is that inexact things contaminate exact things, because now the result is inexact. This is what Clojure does. On Fri, Jun 25, 2010 at 1:18 PM, Garth Sheldon-Coulson

Re: Enhanced primitive support - redux

2010-06-25 Thread Mark Engelberg
A couple points of clarification: On Fri, Jun 25, 2010 at 1:35 PM, Mark Engelberg mark.engelb...@gmail.com wrote: You don't want the hashCode of bigdecimal to match the corresponding double.  They aren't equal, so they shouldn't have the same hashcode. They aren't equal because one is exact

Re: State of Clojure web development

2010-06-25 Thread James Reeves
I'd first like to thank everyone who has replied so far. Your feedback has been invaluable. I'm going to try and address some of the issues people have raised. If I've missed any big ones, feel free to shout louder :) @Joost Could you send me an email with the i18n patches you had to make to

Re: Enhanced primitive support - redux

2010-06-25 Thread Garth Sheldon-Coulson
I should have said they shouldn't be equal based on Rich Hickey's explanation that from now on (= 1 1.0) will return false. I think by this logic (= 1.0M 1.0) should also be false. I have no idea what the current branch actually does though -- haven't tried it yet. Ah, yeah, fair enough. I

Re: State of Clojure web development

2010-06-25 Thread Rick Moynihan
Hi James, Great idea for a survey! I'm using Clojure to bootstrap a startup, broadly in the Healthcare domain. The system we're building comprises a number of components all implemented in Clojure, one of which is a centralised web server. The reason we chose Clojure was because it runs on the

reading from the slime repl

2010-06-25 Thread Conrad
Hi everyone- I am running an emacs slime repl via lein swank. I want to do some simple data input/output by writing a program that runs in the repl. However, when I try to execute (read) through the slime repl it gives a stream closed error. This operation works fine if done through lein repl. Is

Re: Enhanced primitive support - redux

2010-06-25 Thread Mark Engelberg
On Fri, Jun 25, 2010 at 2:39 PM, Garth Sheldon-Coulson g...@mit.edu wrote: Personally, I think (= 3 3M) = true and (= 3/10 0.3M) = true would be nice to have, given that (= 3 3N) = true. Both are currently false in equiv. I also think (= 3.0M 3.00M) = true would be nice. As Rich said, there's

Re: Enhanced primitive support - redux

2010-06-25 Thread Mike Meyer
I'll reiterate a question I asked a while back, but was never answered: Are the bit-bashing operators (bit-*) going to get the same treatment as the arithmetic operators? I would expect that many of the fields that benefit if the latter to be fast would also benefit from the former being fast,

Re: State of Clojure web development

2010-06-25 Thread MarkSwanson
@Mark S Logging is something I've been very interested in at various points in the past, usually when an application goes wrong in production and I have to figure out what went wrong! I think we need to discard the notion that logs should be timestamped I still like timestamps even with

Re: Enhanced primitive support - redux

2010-06-25 Thread Andrzej
On Sat, Jun 26, 2010 at 4:04 AM, Rich Hickey richhic...@gmail.com wrote: equiv, the revenge of num Has it already been decided that some sort of this new numeric tower will find its way into Clojure? Personally, I think this change will open a can of worms and make programming in Clojure more

Re: Clojure / Common Lisp Question

2010-06-25 Thread rob levy
Rich Hickey's insightful videos have caused me to stop writing loops whenever possible. For me this is the same level of thinking-change that happened when I moved to using Structured Programming rather than GOTO (in Fortran). Rich needs to write a paper called Loops considered harmful

Re: Clojure / Common Lisp Question

2010-06-25 Thread rob levy
It can (but its startup is slow, currently). May I ask you why you wouldn't want to use it? One reason is that from what little I know about ABCL it seems more straightforward working with Java libraries in Clojure, but also there is a huge amount of enthusiasm and energy going into Clojure,

Re: Clojure Futures Docs and Functionality

2010-06-25 Thread Meikel Brandmeyer
Hi, Am 25.06.2010 um 20:48 schrieb Daniel Werner: On 25 June 2010 05:27, Ryan Senior senior.r...@gmail.com wrote: (future-await fut2 2 :minutes) ; = done What do others think? I agree – in particular for point 2. For point 1: I think 2 :minutes is not very clojure-like. It sound more like