top | item 12292970

(no title)

xlayn | 9 years ago

Why is such complication introduced and what are the benefits of it?

      firstVar || (secondVar=='Bob' && thirdVar==41)
seems very clear to me.

On the other hand JavaScript has always had logic operators... therefore has always been able to perform logic programming.....

From http://www.ecmascript.org/es4/spec/overview.pdf page 18

  “&&=” and ”||=” operators
     ES4 introduces assignment operators for the logical   
     “&&” and “||” operators. These assignment operators
     are short-circuiting; if the value of the left-hand- 
     side determines the value of the result then the right-     
     handside is not evaluated.

discuss

order

detaro|9 years ago

This library can do Prolog-style solving of logical expressions. As in "here is a set of expressions, find me values for the variables that fulfill them." Completely different thing.

classical example in the readme: https://github.com/mcsoto/LogicJS#goals

xlayn|9 years ago

Thanks for the reply; "Prolog-style solving of logical expressions in JS" sounds like a better title.