fnc

added

ns
clojure.core.logic

type
macro

(fnc args & body)

Define an anonymous constraint that can be used with the unifier:

(let [oddc (fnc [x] (odd? x))]

(unifier {:a '?a} {:a 1} :when {'?a oddc})
;;=> {:a 1}

(unifier {:a '?a} {:a 2} :when {'?a oddc})
;;=> nil
)

Note, the constraint will not run until all arguments are fully ground.

Use defnc to define a constraint and assign a toplevel var.