4 ms·
This is why we love Python! Yeah, I know we should do boring stuff for production and not get creative, but creativity is the real joy. > Prefix (as well as po
by globular-toast 5y ago
This is why we love Python! Yeah, I know we should do boring stuff for production and not get creative, but creativity is the real joy.
> Prefix (as well as postfix) operators are used in languages like LISP/Scheme, and have the nice property of not requiring parenthesis
This reads quite funny because Lisp is famous for its parentheses! The missing bit is parentheses aren't required but only in the binary case. Lisp supports n-ary operators hence why it needs parens.
- gilch 5y agoYou only need the parens when the arity can vary. It doesn't have to be binary. Red and REBOL are prefix languages like Lisp, but without the parentheses, and their calls can have more than 2 arguments. You do have to know the arity of each function to make a parse tree, so the arity of any given function is fixed.