Letting interprete also consume functions as well as protocols would let it bottom out into actual clojure code that actually implements some logic.
Though it would also be handy so have some kind of (escape [bindings] body) clause to allow binding to normal code to temporary names for the sake of implementing logic but without risk of conflict with the symbolic code. On Tue, Jan 8, 2013 at 2:29 AM, kovas boguta <kovas.bog...@gmail.com> wrote: > Maybe the use cases would be more clearer if I fleshed out the > interprete operation. > > The typical case would be > > (interprete expression [protocol1 protocol2 protocol3 ...]) > > interprete would limit its operation the protocols specified; > everything else would be inert. > > To implement compiler passes, you would do > > (-> expression > (interprete protocols-for-phase-1) > (interprete protocols-for-phase-2) > ...) > > and out would come the final expression. > > > On Tue, Jan 8, 2013 at 2:15 AM, kovas boguta <kovas.bog...@gmail.com> wrote: >> 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