Skip to content

Commit

Permalink
Add temporary fix for run in lang.hy
Browse files Browse the repository at this point in the history
  • Loading branch information
jams2 committed Nov 3, 2024
1 parent fcdb32d commit aa3cbc2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/microkanren/lang.hy
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@
`(fresh ~lvars (&& #* goals)))

(defmacro run [n lvars #* goals]
`(lfor state (core.take ~n ((fresh ~lvars ~@goals)(core.empty-state)))
(core.reify (tuple (gfor i (range ~(len lvars)) (core.Var i))) state.sub)))
`(lfor
x
(core.take ~n ((fresh ~lvars ~@goals (fn [s] (core.unit (core.reify ~(tuple lvars) s.sub))))
(core.empty-state)))
x))

(defmacro run* [lvars #* goals]
(hy.macroexpand `(run -1 ~lvars ~@goals)))
Expand Down

0 comments on commit aa3cbc2

Please sign in to comment.