Metaprogramming: Difference between revisions

Content added Content deleted
Line 68: Line 68:
} ifelse
} ifelse
end}.
end}.
</lang>
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>
>| 2 {1 gt} {=} ift
2
</lang>
Instead of

<lang postscript>
>| 2 dup 1 gt {=} ift
2
</lang>
</lang>