Prefix notation

From Esolang
Jump to navigation Jump to search
This article is not detailed enough and needs to be expanded. Please help us by adding some more information.

Prefix notation, or Polish notation, is one of the four operator notations. In this notation, an operator is written in front of all of its operands. It is sometimes combined with surround (when it needs a variable amount of arguments). It is one of the three powerful notations (Prefix, Postfix notation, Surround notation).


To write this line (presented in Infix_notation),

(2 + 2) * 4

In Lisp:

(* (+ 2 2) 4)

Without varargs (pseudo-language):

* + 2 2 4

In this pseudo-language varargs could be supported if parameters use lists for their parameters:

*[+[2 2]4]

which is closer to M-expressions than to the traditional S-expr Lisp structure.

External Links