3 ms·
The main invention here is being able to write a function as drop dup (^2) + (^2) - abs, meaning the same as fn(x,y,z)=>( x * x + y * y - abs(y)). But, it does
by ghusbands 9y ago
The main invention here is being able to write a function as drop dup (^2) + (^2) - abs, meaning the same as fn(x,y,z)=>( x * x + y * y - abs(y)).
But, it does not read at all naturally for a concatenative language. The first two atoms (drop, dup) work in the usual fashion (directly and immediately affecting the stack). Then, the (^2) is just a syntactic input for the + after it, which is now an infix operator, also consuming the (^2) after it. But these _still_ don't yet affect the stack, as the - is also consuming atoms and it consumes the final abs. Then, the expression so built is run against the current stack. It gives the impression of elegance and flexibility by throwing away the very thing that makes concatenative languages what they are.
There are better solutions, like using a scratch space (like the return stack, given in another comment) or otherwise explicitly making given atoms input or output from/to a non-default location.