Hey all, is there a way to insert
multiple records inside of a rule, one for each item in a list. Sorry, I think I'm not sure how to properly ask this but I think my example should describe this pretty well:
(defrule somerule
[SomeRecord (= ?list-of-ids list-of-ids)]
=>
(for [id ?list-of-ids]
(insert! (->Addition id :some-key "icecream"))))
There is insert-all!
that accepts a sequence of facts which may be useful to you https://cljdoc.org/d/com.cerner/clara-rules/0.20.0/api/clara.rules#insert-all!
@mbragg yes! but how do I generate that sequence of facts? It does not allow me to iterate over ?list-of-ids
Oh, I was wrong, I was really tired last night. Thank you @mbragg