11 ms·
What about (sqrt (+ (+ 3 3) (+ 4 4))) read as "square root of the sum of the product of 3 by 3 and 4 by 4" instead of √(3^2+4^2) where √ is prefix, + is infix,
by martyalain 5y ago
What about (sqrt (+ (+ 3 3) (+ 4 4))) read as "square root of the sum of the product of 3 by 3 and 4 by 4" instead of √(3^2+4^2) where √ is prefix, + is infix, ^ is exponent, not to speak of implicits precedences.
in lambdatalk (http://lambdaway.free.fr http://lambdaway.free.fr) one could go beyond and mix html/css using the same syntax, for instance
{div {@ style="color:red"} the hypotenuse of a square triangle (3,4) is equal to {sqrt {+ {* 3 3} {* 4 4}}} }
which can be read like this « write in a div html element, whose style attribute is color red, the hypotenuse of a square triangle (3,4) is equal to the square root of the sum of the product of 3 by 3 and 4 by 4 »
is displayed as « the hypotenuse of a square triangle (3,4) is equal to 5 »
In fact prefixed parenthesis expressions follow the way we think and speak.
- moonchild 5y agoApl can be read as english as well, and frequently also obviates nesting (lisp revels in it, but humans don't deal well with deeply nested structures). Your example: 0.5*⍨+/×⍨3 4. That is, the 0.5 power of the sum of the squares of the legs. But notice: uniform precedence (like lisp) and no nesting whatsoever. (√ as sqrt is not generally primitive, though it can be trivially implemented.)
- martyalain 5y agoWhy is this comment greyed?