Fork me on GitHub
#clara
<
2021-12-10
>
ethanc00:12:02

ah, yeah, i could see that would make it a bit more complicated.

PB00:12:50

Another idea I had was essentially passing a map where we had

{:city1-zip1-road1 "magic-value-1",
 :city2-zip2-road2 "magic-value-2",
 ... ;; a few thousand of these
 :fact-type :path}
(defn join-with-dash
  [& args]
  (apply str/join "-" args))

(defrule moo
  [:account (= account "some-value") (= ?city city)]
  [:route (= ?road road) (= ?zip zip) (= ?joined (join-str-with-dash ?city ?zip ?path))]
  [:path (= ?found-path ?joined)]
  ...
  =>
  (println "do something"))

PB00:12:03

I'm not sure what you think of that idea

PB00:12:34

I suspect it might be more performant

PB00:12:49

Obviously I'm limited to what I can turn into a keyword

ethanc00:12:42

possibly faster, however that would be really tightly coupled to the data itself. In general, the comparisons to make the joins should be fast assuming they simple joins (field equality). I would probably start with a rule similar to the original rule, and do real world testing... if that proves too inefficient then come to the rule and tune it.

PB00:12:20

I appreciate your input @ethanc. Thank you so much

PB00:12:43

I'll try the original and see how it goes

ethanc00:12:00

no problem, if you do see issues, with performance you can log an issue and we can try and identify the source of the pain

PB02:12:30

Much appreciated!