horn a pocket Prolog
program
queries

How horn works

The left side is your program: facts and rules. The right side is where you ask questions about it. Prolog answers by searching for a proof, and tells you which values make your question true.

Keys

What's inside

Unification, backtracking, cut, if-then-else, negation, catch/throw, findall, bagof, setof, assert/retract, DCGs with phrase/2, format/2, unbounded integers, yall lambdas ([X]>>Goal), user-defined operators, and the usual list library: append, member, select, nth0, maplist, foldl, sort/4, sum_list…

Double-quoted text is a list of characters. Lines in your program like %?- member(X, [a,b]). show up as clickable suggestions.

Queries run in a background worker, so an infinite loop never freezes the page.

horn is written from scratch in plain JavaScript, with no dependencies.