Skip to content

Can branch-pattern be supported? #81

@JackSho

Description

@JackSho

Problem

In Clojure maps, distribution is often based on the value of a field (e.g., type). When the value changes, the key in the map also changes.

When I pull, I need to specify all possible keys, as I don't know the value of :type.

;; Type :a has keys qualified with ns a, and similarly for type B.
((query '{:type ?type
          :a/k1 ?a-k1
          :a/k2 ?a-k2
          :b/k1 ?b-k1 ;; keys of B must be written when pull
          })
 {:type :a
  :a/k1 1
  :a/k2 2})
;;=>
{?type :a
 ?a-k1 1
 ?a-k2 2
 ?b-k1 nil ;; confused.
 &?    {:type :a
        :a/k1 1
        :a/k2 2}}

Suggestion

Is it possible to provide a branching design that ensures a one-to-one correspondence between the pattern and the actual data?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions