Re: multi-method dispatch for structs

2008-11-23 Thread wlr
On Nov 23, 4:03 am, Meikel Brandmeyer <[EMAIL PROTECTED]> wrote: > Hi, > > Am 23.11.2008 um 02:29 schrieb James Reeves: > > >> (defn make-person [name age] > >>   (assoc (struct person name age person) :type person)) > > > Maybe you could roll this into a macro: > > > (defmacro struct* > > [type

Re: multi-method dispatch for structs

2008-11-23 Thread Meikel Brandmeyer
Hi, Am 23.11.2008 um 02:29 schrieb James Reeves: (defn make-person [name age] (assoc (struct person name age person) :type person)) Maybe you could roll this into a macro: (defmacro struct* [type & params] `(assoc (struct ~type [EMAIL PROTECTED]) :type ~type)) Why? A function does the sam

Re: multi-method dispatch for structs

2008-11-22 Thread James Reeves
On Nov 22, 10:08 pm, André Thieme <[EMAIL PROTECTED]> wrote: > (defstruct person :name :age) > > (defn make-person [name age] >   (assoc (struct person name age person) :type person)) Maybe you could roll this into a macro: (defmacro struct* [type & params] `(assoc (struct ~type [EMAIL PROTE

Re: multi-method dispatch for structs

2008-11-22 Thread André Thieme
On 14 Nov., 20:11, Jeff Rose <[EMAIL PROTECTED]> wrote: > Hi, >    I'm working on a library where I'd like to be able to dispatch off of > whether the arguments are one of a number of different possible structs. >   I've created a custom hierarchy and everything makes sense with derive > etc., but

Re: multi-method dispatch for structs

2008-11-18 Thread [EMAIL PROTECTED]
On Nov 14, 3:42 pm, Chouser <[EMAIL PROTECTED]> wrote: > On Fri, Nov 14, 2008 at 2:11 PM, Jeff Rose <[EMAIL PROTECTED]> wrote: > > Does my dispatch function have to inspect the passed in values to > > figure out which type of struct they are, or can I query that > > somehow? > > My understanding i

Re: multi-method dispatch for structs

2008-11-18 Thread Stuart Halloway
Hi Steve, Metadata is data that does not contribute to an equality relationship. In most scenarios different types are considered not equal, and so should be modelled as data. Stuart > > On Nov 14, 3:42 pm, Chouser <[EMAIL PROTECTED]> wrote: >> On Fri, Nov 14, 2008 at 2:11 PM, Jeff Rose <[

Re: multi-method dispatch for structs

2008-11-17 Thread [EMAIL PROTECTED]
On Nov 14, 3:42 pm, Chouser <[EMAIL PROTECTED]> wrote: > On Fri, Nov 14, 2008 at 2:11 PM, Jeff Rose <[EMAIL PROTECTED]> wrote: > > Does my dispatch function have to inspect the passed in values to > > figure out whichtypeof struct they are, or can I query that > > somehow? > > My understanding is

Re: multi-method dispatch for structs

2008-11-14 Thread Brian Doyle
I wonder if it would good to have something indicating the struct name put in the metadata when creating a struct? On Fri, Nov 14, 2008 at 1:42 PM, Chouser <[EMAIL PROTECTED]> wrote: > > On Fri, Nov 14, 2008 at 2:11 PM, Jeff Rose <[EMAIL PROTECTED]> wrote: > > Does my dispatch function have to in

Re: multi-method dispatch for structs

2008-11-14 Thread Chouser
On Fri, Nov 14, 2008 at 2:11 PM, Jeff Rose <[EMAIL PROTECTED]> wrote: > Does my dispatch function have to inspect the passed in values to > figure out which type of struct they are, or can I query that > somehow? My understanding is that StructMaps are just Maps with an implementation that's opti

multi-method dispatch for structs

2008-11-14 Thread Jeff Rose
Hi, I'm working on a library where I'd like to be able to dispatch off of whether the arguments are one of a number of different possible structs. I've created a custom hierarchy and everything makes sense with derive etc., but I don't understand how I convert from input values to the sym