core-logic

zilti 2017-08-22T11:19:27.000008Z

How can I execute a core.logic goal repeatedly until exhausted, and use the result as a list in my logic program? I'm looking for the equivalent to "nesting" a run expression, so to speak.

zilti 2017-08-22T13:58:42.000524Z

Basically what I have now is:

(defn next-free-license [ltype]
  (run 1 [q]
       (fresh [licid tid link links license]
              (datascript= [tid :type/name ltype])
              (datascript= [licid :license/type tid])
              (datascript= [licid :license/key license])
              (datascript= [licid :license/user link])
              (membero link links)
              (== q [links licid license]))))
Which gets me [(138 . _0) 6 "532f16c2c9b13540eb6a"] but I need [(138 143 151 153) 6 "532f16c2c9b13540eb6a"]