Proposal - Provide an easy way to create an Artificial intelligence with Javascript

The proposal

  1. I'm thinking of something amazing and I'd like to know what you guys think. I would like a new word in Javascript. new word "law".
  2. "Law" means "law" or "rule".
  3. "Laws" are binary expressions

cases: index.js

console.log(law(0)) // output: 1
console.log(law(1)) // output: 0
console.log(law(0,0)) // output: 1, 1
console.log(law(1,1)) // output: 0, 0

interesting cases

  1. You can create binary sequential expressions with JavaScript.
  2. With binary expressions we can create algorithms for reconnaissance of sequential patterns
  3. We can verify a finite sequence of steps without ìf or else
  4. Programming languages as Prolog offer equivalent support to what I am proposing here
  5. It is possible with the law function to create directives logical with Javascript


  1. All instructions are made by arrays ... sample: function law(){ return array; }
  2. Inputs and outputs are inverse. Example: 0 -> 1 | 1 -> 0 ... etc


  1. GitHub - BijuGC/jsprolog: Prolog in Javascript
  2. GitHub - tau-prolog/tau-prolog: An open source Prolog interpreter in JavaScript

While the idea is intriguing, I'm not sure there's enough demand for such a feature to make it a first class citizen in the language. Prolog itself, while interesting, is rarely used in modern software projects. Likewise, as shown in your prior art links, there's some interest in having Prolog in JavaScript, but apparently not much (neither of those repositories seems to have a lot of use).

I don't think it's wise to toss an idea simply because there's not strong prior art, however, the lack of demand does put an extra burden on the presenter of the proposal to explain why existing prior art solutions aren't in wide use today, and to show that once a proposal like this is out, it would be widely adopted by a large enough portion of the community to make it worth the added complexity to the language.