The proposal
- 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".
- "Law" means "law" or "rule".
- "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
- You can create binary sequential expressions with JavaScript.
- With binary expressions we can create algorithms for reconnaissance of sequential patterns
- We can verify a finite sequence of steps without
ìf
or else
- Programming languages as Prolog offer equivalent support to what I am proposing here
- It is possible with the law function to create directives logical with Javascript
rules
- All instructions are made by arrays ... sample:
function law(){ return array; }
- Inputs and outputs are inverse. Example: 0 -> 1 | 1 -> 0 ... etc
references
- GitHub - BijuGC/jsprolog: Prolog in Javascript
- 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.
2 Likes