Fork me on GitHub
#core-logic
<
2023-12-10
>
Max01:12:35

Is there a function version of conda like or* is for conde? If not, how would one go about creating one? Context: I’m working on a logic program where the number of clauses depends on the input data, I’m trying to avoid doing all the data processing in macros

Max01:12:41

Actually, it turns out conda doesn’t work anyways. What I think I’m looking for is the ability to define a “default match” for when other clauses in a conde (or or*) don’t match. For example:

(conde
  [(membero x [1 2 3]) (membero y [4 5 6])]
  [(membero x [4 5 6]) (membero y [10 11 12])]
  [#_(otherwise? x) (membero y [100 101 102])])

Max01:12:48

I’ve tried specifying the inverse of the other matches, but it seems like core.logic doesn’t have much in the way of negation except nafc, which doesn’t work with fd/in afaict (and fd/in is required for my actual problem). And because fd requires finite ranges, I can’t invert the ranges (e.g. 100–120 -> 0–99, 121–∞)