Logic programming in JavaScript
Have you ever contemplated the possibility of having your computer solve your problems for you, without you having to tell it how? If your answer is a frantic “yes!”, you’re in luck: this is a thing, and this thing is called logic programming. We start writing our logic pragram by declaring the facts that we know. Let’s consider a typical, red-haired, magical family: % main.pl % Facts father(arthur, ron). % Arthur is a father of Ron father(arthur, ginny). % Arthur is a father of Ginny mother(molly, ron). % Molly is a mother of Ron mother(molly, ginny). % Molly is a mother of Ginny In case you’re wondering, this is the Prolog, one of the first and most prominent logic programming languages. ...