如何在 postscript 中创建二维数组?
我想我需要一个数组,其中每个元素都是一个数组,在这种情况下的数组称为形状。
/shape 2 array def
/shape_length 3 def
shape 0 2 array put
shape 1 2 array put
shape 2 2 array put
% [[null, null, null], [null, null, null], [null, null, null]]
我可以创建一个循环,而不是像这样复制一行 3 次。
我可能不需要 shape_length。
这是执行此操作的好方法还是有更简洁的方法?
最佳答案
创建这样的结构确实可以非常简洁地完成:
[3{3 array}repeat]
交互式地使用 Ghostscript,您可以看到它实际上产生了所需的数组:
GS>[3{3 array}repeat]==
[[null null null] [null null null] [null null null]]
关于arrays - Postscript 中的二维数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17242083/