here’s the actual thing:
(run* [q]
(init vars legs)
(with-fresh
(membero ?1 vars)
(membero ?2 vars)
(membero ?3 vars)
(membero ?4 vars)
(== ?1 ["M" ?a1 ?b1])
(== ?2 ["T" ?a2 ?b2])
(== ?3 ["W" ?a3 ?b3])
(== ?4 ["R" ?a4 ?b4])
(== ?b1 ?a2)
(== ?b2 ?a3)
(== ?b3 ?a4)
(== q [?1 ?2 ?3 ?4]))))
vars
is a collection of tuples like this: ["M" "SAN_ANTONIO" "HOUSTON"]
(day of week, start, end)
I’m messing around with a core.logic solution to https://kevinlynagh.com/notes/shipping-puzzle/
but running the above with just 100 tuples take 15 minutes to produce one result
(`with-fresh` just binds all ?
variables to a fresh lvar)
How much faster does it go if you move the memberos to the end?