clara

ethanc 2021-12-10T00:05:02.142700Z

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

PB 2021-12-10T00:06:50.143300Z

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

PB 2021-12-10T00:07:03.143600Z

I'm not sure what you think of that idea

PB 2021-12-10T00:07:34.143800Z

I suspect it might be more performant

PB 2021-12-10T00:07:49.144100Z

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

ethanc 2021-12-10T00:20:42.148500Z

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.

PB 2021-12-10T00:22:20.149300Z

I appreciate your input @ethanc. Thank you so much

PB 2021-12-10T00:22:43.149800Z

I'll try the original and see how it goes

ethanc 2021-12-10T00:33:00.150900Z

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

PB 2021-12-10T02:38:30.151100Z

Much appreciated!