Re: Is there any Clojure magic for "registering" new implementations of something?

2014-08-25 Thread Nahuel Greco
PD: Let's continue this thread on the github ticket. Saludos, Nahuel Greco. On Mon, Aug 25, 2014 at 6:51 PM, Nahuel Greco wrote: > Instead of defining Step superschema can you simply do: > > (s/validate something (get-schema step)) > > ?? > > If you need more than that, for example, if you nee

Re: Is there any Clojure magic for "registering" new implementations of something?

2014-08-25 Thread Nahuel Greco
Instead of defining Step superschema can you simply do: (s/validate something (get-schema step)) ?? If you need more than that, for example, if you need a named schema to use it in function signatures, then I think you have two options: 1- Define a superschema just like in your example, but usi

Re: Is there any Clojure magic for "registering" new implementations of something?

2014-08-25 Thread Laurens Van Houtven
Hi Nahuel, On Saturday, August 23, 2014 7:23:42 PM UTC+2, nahuel wrote: > > what about: > > (defmulti step-handler :type) > (defmulti get-schema :type) ;; returns the schema > > And make your users implement both? Remember schemas are first-class > values. > The difficulty I'm having is figu

Re: Is there any Clojure magic for "registering" new implementations of something?

2014-08-23 Thread Nahuel Greco
what about: (defmulti step-handler :type) (defmulti get-schema :type) ;; returns the schema And make your users implement both? Remember schemas are first-class values. Saludos, Nahuel Greco. On Sat, Aug 23, 2014 at 8:08 AM, Laurens Van Houtven <_...@lvh.io> wrote: > Hi Nahuel, > > > Tha

Re: Is there any Clojure magic for "registering" new implementations of something?

2014-08-23 Thread Laurens Van Houtven
Hi Nahuel, Thanks for your suggestion :) On 22 Aug 2014, at 19:31, Nahuel Greco wrote: > why not multi methods? Multimethods definitely solve the registering a handler problem (because what I really want there is arbitrary dispatch), but don’t solve the “there must be two of these” problem.

Re: Is there any Clojure magic for "registering" new implementations of something?

2014-08-22 Thread Nahuel Greco
why not multimethods? Saludos, Nahuel Greco. On Fri, Aug 22, 2014 at 1:30 PM, Laurens Van Houtven <_...@lvh.cc> wrote: > Hi Clojurers, > > > I'm writing a capability system with Clojure. Make a request to a URL, it > grabs the "plan" for what it should do from the database. A plan consists > (e

Is there any Clojure magic for "registering" new implementations of something?

2014-08-22 Thread Laurens Van Houtven
Hi Clojurers, I'm writing a capability system with Clojure. Make a request to a URL, it grabs the "plan" for what it should do from the database. A plan consists (eventually) of atomic "steps". Typical example of a step would be "make an HTTP request", represented by a map like {:type :http :u