clolog Full-featured logic programming (AKA "Prolog") embedded in/callable from and supporting calls to Clojure. In the spirit of LogLisp, Lisp Machine Prolog, and Franz Inc.'s Allegro Prolog, with some extra goodies. Emphasis on expressive power and execution transparency, supporting rapid prototyping, proof-of-concept development, and outer-loop reasoning (i.e., not real fast, so far). Highlights, with examples Clojure-based, Lispy (i.e., homoiconic) syntax, e.g., ... ( do ; ; Set up, clear knowledge base. ( initialize-prolog ) ; ; Create unit assertion. ( <- ( has-subtype vertebrate mammal)) ; ; Execute query. ( ? ?x ; Answer template ( has-subtype vertebrate ?x) ; Goal. ) ) [mammal] ; Answer(s) in vector (perhaps empty). Logical variable- ("?var")-containing Clojure seqs (so, lists) and vectors as "complex" terms---in assertion statements and answer templates > ( ? ( ?a ?b) ( same [?a 2 ] [ 1 ?b])) [( 1 2 )] Clojure calling predicates Truthiness check: truthy? > ( ? true ( truthy? ( + 1 2 ))) [ true ] ?var-bearing term unification: evals-from? > ( ? ?x ( evals-from? ?x ( + 1 2 ))) [ 3 ] Side effect: do > ( ? nil ( do ( println " Hello " ))) Hello [ nil ] Access to ?var bindings in Clojure calls---even within quoted expressions > ( do ( <-- ( male laban)) ( ? ?y ( male ?x) ( evals-from? ?y ( list '?x)))) [( laban )] Negation as failure: not > ( do ( initialize-prolog ) ; Clear knowledge base. ( ? :nothing ( not ( Huh? )))) [ :nothing ] Facilitated access to Clojure values ( evals-from? shorthand ->? ) in goals with Clojure-calling predicates > ( binding [*leash* true ] ( ? true ( same ( ->? ( + 0 1 )) 1 ))) 0. Processing query: (( same ( ->? ( + 0 1 )) 1 )) Applied ->? transform ( evals-from? ): Entering ( evals-from? ??-0:0 ( + 0 1 )) ( evals-from? ): Succeeded ( evals-from? 1 ( + 0 1 )) ( same ): Entering ( same 1 1 ) ( same ): Succeeded ( same 1 1 ) Recorded answer: true Answer limit reached. ; Because answer template `true` has no ?vars. [ true ] Built-in ter...
First seen: 2025-04-15 17:12
Last seen: 2025-04-16 14:18