2021年1月27日星期三

How to add 1 to every item in a stack in postscript?

I'm really struggling with the syntax in postscript. The program is given 6 values in a stack and needs to return the stack in the same order with 1 being added to every item. I am lost at this point, the program below is the closest I can get. This currently takes a stack and adds 2 to the last value in it.

/map {      1 dict begin            count 0 gt %if more than 0 on stack      {             /x exch def %get first value          x 1 add          /x                }if            end  } def  
https://stackoverflow.com/questions/65928774/how-to-add-1-to-every-item-in-a-stack-in-postscript January 28, 2021 at 07:09AM

没有评论:

发表评论