Comment detail

変形Fizz-Buzz問題 (Nested Flatten)
PostScript で。
文字列処理はやっかいなので、素直に条件を満たしたら上書きで。
1
2
3
4
5
6
7
8
9
%!PS
1 1 20 {
    (hoge)
    1 index 3 mod 0 eq { pop (Fizz) } if
    1 index 5 mod 0 eq { pop (Buzz) } if
    1 index 15 mod 0 eq { pop (FizzBuzz) } if
    exch 10 string cvs print (:) print
    =
} for

Index

Feed

Other

Link

Pathtraq

loading...