hydrocomputer
Programmer
Hello,
I thought I understood stack programming until I tried postscript. I cannot seem to pass parameters to a named function and get back a result, as in the following example (tested on ghostscript) any help?
0 0 1 setrgbcolor
/average {add 2 div} def
newpath
{
50 150 average % this should put 100 on the stack, right?
100 moveto 100 0 rlineto 0 100 rlineto -100 0 rlineto
closepath
} ufill
showpage
I thought I understood stack programming until I tried postscript. I cannot seem to pass parameters to a named function and get back a result, as in the following example (tested on ghostscript) any help?
0 0 1 setrgbcolor
/average {add 2 div} def
newpath
{
50 150 average % this should put 100 on the stack, right?
100 moveto 100 0 rlineto 0 100 rlineto -100 0 rlineto
closepath
} ufill
showpage