zzz6519003 / blog

My blog about coding
4 stars 1 forks source link

miniKanren day-2 #94

Open zzz6519003 opened 7 years ago

zzz6519003 commented 7 years ago

A common feature of functional programming languages is pattern matching,

matche is a pattern matching version of conde that makes this kind of code much more clear and concise.

Pattern matching has reduced the function to its essence.

The answer is that unlike Clojure, which doesn’t require you to destructure every key, core.logic map patterns must match exactly.

Bringing maps and partial maps into logic programming makes expressing many kinds of problems much clearer. You might ask why featurec is not featureo. The simple answer is that it’s not a relation.

condu works similarly to conda, except that instead of limiting solutions to a single branch, it stops completely after a single solution is found.

Which kind of conditional you choose depends on what you’re trying to do. If you’re not sure which to use, start with conde.