Re: Best practices for protocols

2010-10-16 Thread Shantanu Kumar
These strangeloop slides [PDF] by Chouser may help: http://strangeloop2010.com/talk/presentation_file/14491/Houser-ClojureExpressionProblem.pdf Regards, Shantanu On Oct 16, 11:45 pm, Zach Tellman wrote: > I've dealt with a similar problem when creating Penumbra [1].  An > 'app' has several most

Re: precise numbers

2010-10-16 Thread David Sletten
Steven, Thanks for your comments. You bring up some interesting points, however, you also raise some more questions. First, you criticize my use of the variable name 'epsilon'. Of course, this usage is entirely consistent with its ubiquitous use in mathematics. I am designating a(n) (arbitrari

Re: precise numbers

2010-10-16 Thread Matt Fowles
All~ A good "close enough" comparison is actually very difficult. I adapted one based on http://adtmag.com/Articles/2000/03/16/Comparing-Floats-How-To-Determine-if-Floating-Quantities-Are-Close-Enough-Once-a-Tolerance-Has-Been.aspx?Page=1 which provides a pretty good example and handles all the

Re: precise numbers

2010-10-16 Thread Steven E. Harris
cej38 writes: > (defn float= > ([x y] (float= x y 0.1)) > ([x y epsilon] > (let [scale (if (or (zero? x) (zero? y)) 1 (Math/abs x))] >(<= (Math/abs (- x y)) (* scale epsilon ) You're scaling epsilon incorrectly here. Epsilon defines the smallest value that yields a value

sql and cursors

2010-10-16 Thread Kyle R. Burton
As far as I can tell, contrib.sql's functions do not use database cursors (at least for PostgreSQL, again as far as I can tell). For result sets that are larger than you'd like to load into the running process, but rather step through the results and have them fetched on demand from the server, I'

Re: Idiomatic Way to Keep a Variable Private to a Namespace

2010-10-16 Thread ka
I've been wondering about having let over defn, I have the following concerns - 1. Not recommended in the docs http://clojure.org/special_forms#Special%20Forms--%28def%20symbol%20init?%29 says - Using def to modify the root value of a var at other than the top level is usually an indication that y

Re: Idiomatic Way to Keep a Variable Private to a Namespace

2010-10-16 Thread Steven E. Harris
ataggart writes: > It's fairly common to let over a function, e.g.: So common, in fact, that Doug Hoyte wrote a book about it: Let Over Lambda http://www.letoverlambda.com/ -- Steven E. Harris -- You received this message because you are subscribed to the Google Groups "Clojure" group.

Re: Best practices for protocols

2010-10-16 Thread Zach Tellman
I've dealt with a similar problem when creating Penumbra [1]. An 'app' has several mostly orthogonal pieces: window management, input handlers, action queues, and so on. From an implementation standpoint, it's very desirable to split these up, but we don't want to expose that to the user. What I

Re: Best practices for protocols

2010-10-16 Thread Christian Vest Hansen
My understanding of protocols is this: they are an abstraction representation of data. They allow you to write functions, building upon the protocol, such that they work for all concrete implementations of that protocol. So the protocol is a view on data. And the many ways of modifying the data is

Traffic junctions as a metaphor for understanding the STM?

2010-10-16 Thread Sam Aaron
This might be slightly off the wall, but I recently watched a tiny documentary about an experimental congestion control strategy in the UK where at a busy junction they disabled the traffic lights. Interestingly it reminded me of Clojure's STM (except on car crashes a big robot arm would scoop u