core-logic

2021-05-18T22:52:49.002100Z

Is there a way to get all potential values for a logic var in a list? So basically a way to run this in one step? I feel like that should be obvious, but I don't see it

(let [result (run* [q] ...)]
  (run* [q]
    (membero q result)
    ...))

2021-05-18T22:54:43.002800Z

(there might be other constraints that need to access the value of result )

2021-05-18T23:06:56.003100Z

no

2021-05-18T23:34:53.003600Z

Thanks! :D

2021-05-18T23:37:11.005800Z

Related question: Is it possible to build prologs findall? That would provide a different way to solve the problem... I have this so far:

(defna findall [pred col result]
  ([_ [] []])
  ([_ [?x . ?rc] [?x . ?rr]]
   (pred ?x)
   (findall pred ?rc ?rr))
  ([_ [_ . ?rc] _]
   (findall pred ?rc result)))
but it's not relational, and I'm not sure it works as I would expect in all cases. (Would pass it something built with fne as pred )