I'm solving a sub-part of my problem using core.logic
. I'm anticipating that the declarative nature of describing the problem would lead to poor performance on large inputs.
But the setup I have is that the inputs to core.logic rarely change, but I query them a lot. So naturally I think that memoization would speed up the performance.
I could only memoize the results from top-level (l/run*
form, but again that's less efficient than memoizing at every l/defne
or at every call to conde
, because the latter can give the same speedups as dynamic-programming does.
But I do not understand what kind of values (like LVar
s introduced by fresh) pass between the logical clauses. They are different from regular clojure values, and I have never even called one of the clauses (like l/==
or l/membero
) "normally". They are always called indirectly by l/run*
.
So, do I need to do anything special if I want to memoize such defne
s?