Fork me on GitHub

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.


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"]