Close.

The defmulti would be closer to

 (defmulti mm first)

because we need to dig into the list to get the first symbol.

But there need to be a way to recurse as well, if you want to
interprete the whole expression. That part is hard to capture in the
multimethod.

(interprete '(foo (bar 1)))

whether you start at foo and go down or at bar and go up could be a
property of the symbolic system, itself determined by protocols.



On Tue, Jan 8, 2013 at 2:05 AM, Ambrose Bonnaire-Sergeant
<abonnaireserge...@gmail.com> wrote:
> Semantically, are you thinking along the lines of a multimethod that
> dispatches on identity?
>
> (defmulti mm identity)
>
> (defmethod mm 'bar
>   ...)
>
> (defmethod mm 'foo
>   ...)
>
> Thanks,
> Ambrose
>
> On Tue, Jan 8, 2013 at 2:56 PM, kovas boguta <kovas.bog...@gmail.com> wrote:
>>
>> This is a pretty embryonic idea, but I'm wondering if anyone has
>> thought the same, or seen relevant examples/literature.
>>
>> The idea is: What if we could attach protocols to symbols themselves?
>>
>> so (foo '(bar 1))
>>
>> would have its behavior defined by a protocol implemented on the symbol
>> bar.
>>
>> This could be a way to create symbolic systems in clojure.
>>
>> Besides being of theoretical interest, symbolic systems can be a
>> composable way to achieve metaprogramming.
>>
>> We could instruct that any expression should be first interpreted
>> symbolically with a tag like #symbolic
>>
>> --
>> 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 members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>
>
> --
> 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 members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to