Metaprogramming: Difference between revisions
Content deleted Content added
Fixed typos. |
|||
Line 185: | Line 185: | ||
=={{header|PostScript}}== |
=={{header|PostScript}}== |
||
PostScript allows the reification of stack, scoping (dynamic scoping is default, but lexical scoping can be implemented using immediate loading), bindings using dictionaries, and even control flow. Here is an example of implementation of if statement |
|||
{{libheader|initlib}} |
{{libheader|initlib}} |
||
<lang postscript> |
<lang postscript> |
||
Line 201: | Line 201: | ||
end}. |
end}. |
||
</lang> |
</lang> |
||
The standard if expression in |
The standard if expression in PostScript does not take a predicate. Instead it acts on the boolean value on top of the stack. This newly created word allows us to do |
||
<lang postscript> |
<lang postscript> |
||
>| 2 {1 gt} {=} ift |
>| 2 {1 gt} {=} ift |