News for hackers. Stuff that matters.
Re:PostScript 1.0 – A Code Study by WCSTombs on Friday October 04, 2024 @11:00PM (#41747422)
Slightly tangential, but here's my own Sierpinski triangle program from a couple of decades ago, which IMO is considerably simpler than what they show:

    %!

    /threshold 4 def

    /Sierpinski {
     dup threshold ge {
      3 {dup 2 div Sierpinski dup 0 rmoveto 120 rotate} repeat
     } {
      3 {dup 0 rlineto 120 rotate} repeat closepath
     } ifelse
     pop
    } bind def

    50 50 moveto 512 Sierpinski fill
    showpage
It actually can be simplified a bit more, and the explicit recursion can be removed entirely, since there's already a free operand stack.

There are no comments on this comment yet.