Uploaded image for project: 'core.logic'
  1. LOGIC-44

ex* could expand macros in patterns

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Labels:
      None
    • Patch:
      Code and Test

      Description

      So, tagged data structures are probably interesting in a relational context. Say you have a relation with some default logic about dogs:

        (defna friendlyo [Dog-Or-Breed]
          ([:Spot] succeed)
          ([:Spike] fail)
          ([Other-Dog] (fresh [Breed] (dog-breed Other-Dog Breed) (friendlyo Breed)))
          ([(breed :miniature-dachshund)] fail)
          ([(breed :golden-retriever)] succeed)
          ;. . .)
      

      Assume there's a (defmacro breed [t] `[:breed ~t]).

      That's nicer than having to drop [:breed :golden-retriever] in there or whatever, since it's compile-time-checkable, less error-prone, reduces duplication, etc.

      This little patch makes ex* expand macros in patterns so it doesn't treat e.g. (breed :golden-retriever) as introducing a new LVar called "breed". Test also provided.

        Attachments

          Activity

            People

            • Assignee:
              dnolen David Nolen
              Reporter:
              alex+import import
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: