Re: Define a protocol as a superset of another

2011-08-28 Thread Alexandre Patry
Thanks Luc and Stuart for your answers. I will try to make my protocols more orthogonal than hierarchical in order to make them fit this philosophy. On 2011-08-28, at 3:43 PM, Stuart Sierra wrote: > Hi Alexandre, > > Clojure Protocols do not support inheritance. This was a design choice. > P

Re: Define a protocol as a superset of another

2011-08-28 Thread Alexandre Patry
On 2011-08-28, at 2:27 PM, Luc Prefontaine wrote: > On Sun, 28 Aug 2011 14:19:46 -0400 > Alexandre Patry wrote: > Some reading: > > http://david-mcneil.com/post/1475458103/implementation-inheritance-in-clojure Thanks for the quick answer. >From what I understand, this a

Define a protocol as a superset of another

2011-08-28 Thread Alexandre Patry
Hi, I would like to define a protocol as a super set of another. For example: (defprotocol P1 (f [this])) (defprotocol P1WithExtras ;; something like :extends P1 (g [this])) ;; P1WithExtras should now contain f and g. I may have missed, but I did not find how to do it from the documentat

Re: Specialize collection

2011-02-17 Thread Alexandre Patry
On 11-02-17 10:33 AM, pba wrote: Not quite, the queue size needs to be passed in at instantiation time for example you may want to have a 10 or 100 element queue depending on the element type. What I'm looking for is to somehow decorate the queue (or some other object) with behavior constraints (

Re: How can I avoid needing this other function?

2010-12-06 Thread Alexandre Patry
On 10-12-07 01:37 AM, Alex Baranosky wrote: Hello Alexandre, This code makes my tests pass: (defn distances [origin & locations] (map #(dist-in-miles origin %) locations)) (defn map-of-distances [origin & locations] (apply hash-map (interleave locations (apply distances origin locations))

Re: How can I avoid needing this other function?

2010-12-06 Thread Alexandre Patry
On 10-12-07 12:44 AM, Alex Baranosky wrote: Here is the code I'm working on. The first function is wanted. The second is not. (and the duplication is waiting to be factored out somehow...) Is there an idiomatic Clojure way to use map-of-distances on the "Line of Note" below, instead of map-o

Re: Calling apply on java methods

2010-05-11 Thread Alexandre Patry
Le 2010-05-11 13:45, Heinz N. Gies a écrit : On May 11, 2010, at 19:39 , Alexandre Patry wrote: I am trying to call a java method using apply, like : (apply .println [System/out "hello" "world"]) But I get an error: "Unable to resolve symbol: .println in th

Calling apply on java methods

2010-05-11 Thread Alexandre Patry
I am trying to call a java method using apply, like : (apply .println [System/out "hello" "world"]) But I get an error: "Unable to resolve symbol: .println in this context" Am I missing something? Thanks, Alex -- You received this message because you are subscribed to the Google Groups "Cloj

Re: Name suggestions

2010-03-19 Thread Alexandre Patry
Frank Hale wrote: clojure + native = clotive or clo-jive, like clojure dancing with another language. Alex -- 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 mem

Re: Name suggestions

2010-03-18 Thread Alexandre Patry
On Wed, Mar 17, 2010 at 3:08 AM, mac wrote: After just a little more test and polish I plan on calling clj-native 1.0. But clj-native is a *really* boring name so I want to change it before 1.0 and I don't have very good imagination when it comes to these things. So I need your help. It d

Re: XML problem

2010-02-10 Thread Alexandre Patry
Hi, yvan wrote: Hello Clojure group I am testing Clojure and I have an error parsing thix XML excerpt below. Is this a SAX bug ou a Clojure bug .. or my mistake ? thank's for help IN REPL (ns x (:require [clojure.xml :as xml]) ) x=> (try (xml/parse "exampleSortieXML.xml")(catch E