I'm trying to understand the programming philosophy expressed in some of
the videos, as it relates to dealing with data with different
representations. There's a lot of emphasis on working with basic collection
types, not using getters and setters, and so-forth.
I have a fairly common
On 25/10/12 16:59, Brian Craft wrote:
I have a fairly common scenario where I have a set of operations that
need to work on two types of data (not data types in the clojure
sense) that have different internal structure (i.e. maps with
different keys). I could write a generic function that
I have a fairly common scenario where I have a set of operations that
need to work on two types of data (not data types in the clojure sense)
that have different internal structure (i.e. maps with different keys).
Could you please be a little more concrete? If you provide a specific
example,
On Thu, Oct 25, 2012 at 8:59 AM, Brian Craft craft.br...@gmail.com wrote:
I have a fairly common scenario where I have a set of operations that need
to work on two types of data (not data types in the clojure sense) that
have different internal structure (i.e. maps with different keys). I could
On Thursday, October 25, 2012 9:16:58 AM UTC-7, Jim foo.bar wrote:
On 25/10/12 16:59, Brian Craft wrote:
I have a fairly common scenario where I have a set of operations that
need to work on two types of data (not data types in the clojure
sense) that have different internal structure
On Thu, Oct 25, 2012 at 11:03 AM, Brian Craft craft.br...@gmail.com wrote:
that's getting very OOP, and I doubt it's idiomatic clojure.
http://www.ibm.com/developerworks/library/j-clojure-protocols/
?
--
You received this message because you are subscribed to the Google
Groups Clojure group.
On Thursday, October 25, 2012 11:07:23 AM UTC-7, raould wrote:
On Thu, Oct 25, 2012 at 11:03 AM, Brian Craft
craft...@gmail.comjavascript:
wrote:
that's getting very OOP, and I doubt it's idiomatic clojure.
http://www.ibm.com/developerworks/library/j-clojure-protocols/
?
Hm,
On Thu, Oct 25, 2012 at 11:17 AM, Brian Craft craft.br...@gmail.com wrote:
http://www.ibm.com/developerworks/library/j-clojure-protocols/
since different protocols would collide. E.g. two shapes represented by maps
are going to dispatch to the same area protocol, I think, since they're
both
On Thu, Oct 25, 2012 at 11:17 AM, Brian Craft craft.br...@gmail.com wrote:
http://www.ibm.com/developerworks/library/j-clojure-protocols/
Hm, yeah, I don't really get protocols, yet. They seem to be all about java
classes. If I'm using a map to represent some type of data, would I start
On 25/10/12 19:20, Raoul Duke wrote:
On Thu, Oct 25, 2012 at 11:17 AM, Brian Craft craft.br...@gmail.com wrote:
http://www.ibm.com/developerworks/library/j-clojure-protocols/
since different protocols would collide. E.g. two shapes represented by maps
are going to dispatch to the same area
On Thursday, October 25, 2012 11:32:11 AM UTC-7, Jim foo.bar wrote:
On 25/10/12 19:20, Raoul Duke wrote:
On Thu, Oct 25, 2012 at 11:17 AM, Brian Craft
craft...@gmail.comjavascript:
wrote:
http://www.ibm.com/developerworks/library/j-clojure-protocols/
since different protocols
On 25/10/12 19:38, Brian Craft wrote:
Multimethods seem like a convenience layer over duck typing: probe the
object to see what it is, then dispatch. Is that a fair description?
Not exactly...MUlti-methods have no limitations with regarding dispatch.
You can dispatch on anything...I mean
On Thu, Oct 25, 2012 at 11:38 AM, Brian Craft craft.br...@gmail.com wrote:
Multimethods seem like a convenience layer over duck typing: probe the
object to see what it is, then dispatch. Is that a fair description?
maybe if you squint. but i wouldn't have said so, just to my way of thinking.
On Thursday, October 25, 2012 11:44:50 AM UTC-7, Jim foo.bar wrote:
On 25/10/12 19:38, Brian Craft wrote:
Multimethods seem like a convenience layer over duck typing: probe the
object to see what it is, then dispatch. Is that a fair description?
Not exactly...MUlti-methods have no
On 25/10/12 19:49, Brian Craft wrote:
heh. I see. Thanks!
No problem...;-)
Jim
ps: It goes without saying that you shouldn't sprinkle your code with
multi-methods just because you can! Trust me, I know they are nice and
very tempting to use but save them for when you truly need
Sent from a smartphone, please excuse the brevity/typos.
Le 25 oct. 2012 à 20:44, Jim - FooBar(); jimpil1...@gmail.com a écrit :
On 25/10/12 19:38, Brian Craft wrote:
Multimethods seem like a convenience layer over duck typing: probe the
object to see what it is, then dispatch. Is that a fair
On 25/10/12 20:33, Laurent PETIT wrote:
Wow, this kind of decision is not for the faint of heart.
Not to be taken lightly, that's for sure! Because then, your code
becomes non pure, harder to test, etc.
not saying that it was not appropriate in your case, but rather than
used as a
(fn [_ _] ;dispatch-function checks for OS - ignores args
(let [os (System/getProperty os.name)]
(if (.startsWith os Mac OS) :Linux (keyword os)
This seems like a very poor use of multi-methods. Multi-methods exist to
provide both dynamic and open dispatch. In this case, the
You say that from the safe standpoint of being able to enumerate all
OSes in advance...I can imagine a world where anyone can have his own
OS. :-)
Seriously now, this is not production code obviously! just a demo...
Jim
On 25/10/12 21:04, Brandon Bloom wrote:
|(||fn||[||_
On Thu, Oct 25, 2012 at 11:38 AM, Brian Craft craft.br...@gmail.com wrote:
Multimethods seem like a convenience layer over duck typing: probe the
object to see what it is, then dispatch. Is that a fair description?
I think that's pretty accurate. Others have pointed out that multimethods
On Thursday, October 25, 2012 1:49:53 PM UTC-7, puzzler wrote:
On Thu, Oct 25, 2012 at 11:38 AM, Brian Craft craft...@gmail.comjavascript:
wrote:
Multimethods seem like a convenience layer over duck typing: probe the
object to see what it is, then dispatch. Is that a fair description?
On Thu, Oct 25, 2012 at 1:49 PM, Mark Engelberg
mark.engelb...@gmail.com wrote:
So my vote is for multimethods, which is at least as clean and fast as
manual dispatch with more flexibility. Records/protocols may have some
additional performance benefits in the right use cases, but in my
22 matches
Mail list logo