Re: Is ClojureCLR converging toward a release?

2010-10-14 Thread Miki
What's the status on Mono? On Oct 11, 3:39 pm, dmiller dmiller2...@gmail.com wrote: Check out the downloads area onhttp://github.com/richhickey/clojure-clr. Grab clojure-clr-1.2.0.zip.  Unzip, start up Clojure.Main.exe and you should be running.  The zip also contains Clojure.Compile.exe,

Re: precise numbers

2010-10-14 Thread Felix H. Dahlke
OKay, I think I get it. Thanks :) On 14/10/10 00:56, David Sletten wrote: Here's a slightly more informal argument. Suppose you challenge me that 1 is not equal to 0.... What you are saying is that 1 - 0.... is not equal to 0, i.e., the difference is more than 0. But for any positive

Re: precise numbers

2010-10-14 Thread Nicolas Oury
Another proof: Let study the sequence sn = 0....9 , with n 9s. Or s0= 0 and s(n+1) = sn + 9 / 10 ^n lim sn = 0.9... and lim sn = 1. so If I remember my meth correctly, the number 0... does not exist. This not a legal decimal sequence. (Any decimal sequence finishing

Re: Override print-method of struct

2010-10-14 Thread andrei
Interesting approach. I'll keep it in mind, but for this particular project I actually have to have mutable objects - both parents and children must be modifyable. Also I really want to see them as collections: closures where used everywhere in the previous version of program, and it was very hard

Re: Test-driven development in Clojure

2010-10-14 Thread Felix H. Dahlke
Oh, I think I missed your suggestion of multimethods. They do in fact look pretty interesting, but I wasn't able to figure out how that would solve my problem - they look more like overloading than polymorphism to me. Would you mind posting a variant of my example that uses multimethods? On

Re: precise numbers

2010-10-14 Thread Julian
For the sake of comparison with other LISPs - some Scheme implementations have an exact? function for dealing with non-precise numbers. This seems not to have come across to Clojure. (Although we do have ratios and BigInteger). JG -- You received this message because you are subscribed to the

Re: Override print-method of struct

2010-10-14 Thread sune.simonsen
Maybe you could use a parent map. You have a normal tree, and then you have a map where you can get the parent for a given node. I don't know if this will be too slow for your problem - it's just an idea. Kind regards Sune On Oct 13, 6:45 pm, andrei andrei.zhabin...@gmail.com wrote: How can I

RFE: modify description of assoc

2010-10-14 Thread Ralph
First, how do I submit a request for enhancement? Second, the documentation for assoc in clojure.core should probably include (assoc vector index val) and (assoc vector index val ivs) in the usage line. -- You received this message because you are subscribed to the Google Groups Clojure group.

Re: Override print-method of struct

2010-10-14 Thread andrei
Maybe you could use a parent map. You have a normal tree, and then you have a map where you can get the parent for a given node. I don't know if this will be too slow for your problem - it's just an idea. I haven't thought about it, thank you. I'm going to try different options and decide

Re: precise numbers

2010-10-14 Thread cej38
I am kinda sorry that I started this whole thing. I don't need another lesson in limits. The simple fact of the matter is that, in my code, I run into a place where I have a comparison (= some-value (some-function some-data)), the function, data, and value can change. In a use case that I am

Python like hash-map constructor (a.k.a. dict)

2010-10-14 Thread Henk
Hi All, In Python I was used to be able to easily create dictionaries from lists of key value 'pairs' (tuples or list), e.g. like this: dict([(10, 20), (30, 40)]) #using the dict constructor = {10:20, 30:40} What would be the equivalent in Clojure?, e.g. the normal Clojure hash- map function

Re: Python like hash-map constructor (a.k.a. dict)

2010-10-14 Thread liebke
Here's one approach: (into {} [[:a 1] [:b 2] [:c 3]]) = {:a 1, :b 2, :c 3} On Oct 14, 11:54 am, Henk henkp...@gmail.com wrote: Hi All, In Python I was used to be able to easily create dictionaries from lists of key value 'pairs' (tuples or list), e.g. like this: dict([(10, 20), (30, 40)])

Re: precise numbers

2010-10-14 Thread Brian Hurt
On Thu, Oct 14, 2010 at 12:07 PM, cej38 junkerme...@gmail.com wrote: I am kinda sorry that I started this whole thing. I don't need another lesson in limits. The simple fact of the matter is that, in my code, I run into a place where I have a comparison (= some-value (some-function

Re: Python like hash-map constructor (a.k.a. dict)

2010-10-14 Thread Chris Perkins
On Oct 14, 11:54 am, Henk henkp...@gmail.com wrote: (I did some small benchmarks on this), while the list comprehension itself is much faster than python... Not an answer to your question, but: depending on what you mean by much faster, there is a good chance that you measured the clojure for

Re: resultset-seq

2010-10-14 Thread Mark Engelberg
Since no one chimed in with support or reasoning for resultset-seq's current lower-casing behavior, can we discuss changing it to case-maintaining behavior, or at least make it something you can set with an optional flag? On Sun, Oct 10, 2010 at 8:41 PM, Mark Engelberg mark.engelb...@gmail.com

sql utilities

2010-10-14 Thread Kyle R. Burton
I've written some sql helper functions that will do things like list the objects in the database and describe a table. I've found these handy when doing interactive development as I don't have to jump over to another app to see what the make up of tables are. I've also used it in some scenarios

Re: RFE: modify description of assoc

2010-10-14 Thread Michael Ossareh
On Thu, Oct 14, 2010 at 08:02, Ralph grkunt...@gmail.com wrote: First, how do I submit a request for enhancement? I believe the process is: a) register on assembla, b) submit ticket ( http://www.assembla.com/spaces/clojure/tickets/custom_report/2729 ) If you intend to provide the change via

generator in Clojure

2010-10-14 Thread clwham...@gmail.com
I need a function that produces the 'next' value from a lazy-seq -- something like a Python generator. I imagine it would have to be some sort of closure like: (def next-sine (let [sines (atom (cycle (map sin (range 0 6.28 0.01] #(swap! sines rest))) Is there a more idomatic way

Re: Test-driven development in Clojure

2010-10-14 Thread Armando Blancas
Maybe something like this. Those calls polymorphic on the returrn value of the anynimous function, so this is more powerful than overloading. (defmulti load-page (fn [p n] (:id p))) (defmethod load-page :db [loader name] (println db provider for page name)) (defmethod load-page :fs [loader name]

Re: sql utilities

2010-10-14 Thread Shantanu Kumar
This is fantastic! Does it work reliably for most JDBC drivers? Some drivers may not implement meta data API very well, and some drivers may have their own idiosyncrasies. You can perhaps setup a GitHub project and push to Clojars if this doesn't get into contrib any time soon. Regards, Shantanu

Re: resultset-seq

2010-10-14 Thread Shantanu Kumar
+1 Sounds good. Regards, Shantanu On Oct 14, 11:58 pm, Mark Engelberg mark.engelb...@gmail.com wrote: Since no one chimed in with support or reasoning for resultset-seq's current lower-casing behavior, can we discuss changing it to case-maintaining behavior, or at least make it something you

Re: generator in Clojure

2010-10-14 Thread Moritz Ulrich
Are you sure you need to capture the state in next-sine? It's not very clojure-ly to have functions with state. I would capture the state in the caller as an integer and just use get or nth on the lazy seq. If you want to stick to your impure function, please mark it with a ! at the end:

Re: sql utilities

2010-10-14 Thread Kyle R. Burton
This is fantastic! Does it work reliably for most JDBC drivers? Some drivers may not implement meta data API very well, and some drivers may have their own idiosyncrasies. You can perhaps setup a GitHub project and push to Clojars if this doesn't get into contrib any time soon. I have made

Re: generator in Clojure

2010-10-14 Thread Nicolas Oury
(defn iterate [s] (let [a (atom s)] (fn [] (let [s @a] (reset! a (next s)) (first s)) but it's not very idiomatic in clojure. (In Lisp it is traditional to hide a state in a closure. A lot of toy object language work like that) On Thu, Oct 14, 2010 at

Re: Python like hash-map constructor (a.k.a. dict)

2010-10-14 Thread Henk
Thanx!, That is exactly what I was looking for!, Being a clojure newbie and a non-native speaker it is hard to find the correct function among many in clojure core API :-) If only the documentation would provide simple examples like you provided... On 14 okt, 18:20, liebke lie...@gmail.com

Re: generator in Clojure

2010-10-14 Thread clwham...@gmail.com
I originally thought of calling nth on the seq but isn't that pretty wildly inefficient? On Oct 14, 1:38 pm, Moritz Ulrich ulrich.mor...@googlemail.com wrote: Are you sure you need to capture the state in next-sine? It's not very clojure-ly to have functions with state. I would capture the

Re: Python like hash-map constructor (a.k.a. dict)

2010-10-14 Thread Henk
Does dotimes force evaluation?, if so, then the Clojure version is about twice as fast for me... which would be nice to finally find a good dynamic programming language that is also nice and fast :-) the code I tested is this: (def HHQ [{:id 1956, :firstname Piet, :lastname Puk,

Re: precise numbers

2010-10-14 Thread David Sletten
On Oct 14, 2010, at 12:07 PM, cej38 wrote: I am kinda sorry that I started this whole thing. I don't need another lesson in limits. The simple fact of the matter is that, in my code, I run into a place where I have a comparison (= some-value (some-function some-data)), the function, data,

Re: Python like hash-map constructor (a.k.a. dict)

2010-10-14 Thread David Nolen
On Thu, Oct 14, 2010 at 4:54 PM, Henk henkp...@gmail.com wrote: Thanx!, That is exactly what I was looking for!, Being a clojure newbie and a non-native speaker it is hard to find the correct function among many in clojure core API :-) If only the documentation would provide simple

CongoMongo - which version/fork is most uptodate

2010-10-14 Thread gammelgedden
I have recently looked at mongodb and liked the idea of a schema less database. I found somnium.congomongo and played with that for a while, but ran into some issues - it doesnt work with the current release 2.2 of mongo java driver - lots of reflection warnings - perhaps lacking some finish...

Re: sql utilities

2010-10-14 Thread Saul Hazledine
On Oct 14, 9:16 pm, Kyle R. Burton kyle.bur...@gmail.com wrote: I've written some sql helper functions that will do things like list the objects in the database and describe a table.  I've found these handy when doing interactive development as I don't have to jump over to another app to see

Re: Python like hash-map constructor (a.k.a. dict)

2010-10-14 Thread Meikel Brandmeyer
Hi, Am 14.10.2010 um 23:07 schrieb Henk: Does dotimes force evaluation?, At a different level. (dotimes [n 1] (for ...)) does evaluate the for form. But it returns a seq which is never realised. So you do effectively … nothing. (dotimes [n 1] (into [] (for ...))) as in your example

Re: generator in Clojure

2010-10-14 Thread Alan
Yes, it would be. But it's wildly unlikely that you need to do it. You don't say what you're using next-sine! for, but I'll imagine you're doing something like printing it. Maybe your code looks like: (dotimes [n num-iters] (let [s current-sine] (next-sine!) (println s))) This can

Re: Python like hash-map constructor (a.k.a. dict)

2010-10-14 Thread Alan
I wouldn't say it has *nothing* to do with dotimes. If dotimes were lazy rather than eager, then his form would do nothing despite the eagerness of into, because into is not being called: (for [i (range 100)] (into [] (some-expensive-calc))) On Oct 14, 3:34 pm, Meikel Brandmeyer

Re: CongoMongo - which version/fork is most uptodate

2010-10-14 Thread Mark Engelberg
I've been having trouble with congomongo for the reasons you specified, and a few more (doesn't sort, ran into a bug where limit was working properly with large datasets). I recently switched to the karras clojure wrapper for mongodb (http://github.com/wilkes/karras), and found it to be much more

Re: sql utilities

2010-10-14 Thread Stuart Campbell
Thanks Kyle. Looks useful! On 15 October 2010 09:25, Saul Hazledine shaz...@gmail.com wrote: On Oct 14, 9:16 pm, Kyle R. Burton kyle.bur...@gmail.com wrote: I've written some sql helper functions that will do things like list the objects in the database and describe a table. I've found

Java Source Indentation

2010-10-14 Thread David Jacobs
I've just started learning Clojure and I'm excited about what I see. The combination of power and sophistication in the language is refreshing, and I've started to dive into the source code to understand it better. One meta-observation has come out of my scouring. The indentation used for the

Re: Java Source Indentation

2010-10-14 Thread Santosh Rajan
IMHO if it is not broken, dont fix it. I am sure the original authors are aware and are very much around. Probably they would be the best people to do it anyway. On Fri, Oct 15, 2010 at 7:43 AM, David Jacobs develo...@allthingsprogress.com wrote: I've just started learning Clojure and I'm

Re: Java Source Indentation

2010-10-14 Thread B Smith-Mannschott
On Fri, Oct 15, 2010 at 04:13, David Jacobs develo...@allthingsprogress.com wrote: I've just started learning Clojure and I'm excited about what I see. The combination of power and sophistication in the language is refreshing, and I've started to dive into the source code to understand it