整数リストの短縮
Scheme どう書く?的 - higepon blog を PostScript で
[1 3 4 5 6 12 13 15] [exch{ 1 index type /arraytype eq{ dup 1 sub 2 index 1 get eq{ 2 copy 1 exch put pop }if }{ 2 copy 1 sub eq{ 2 array astore }if }ifelse }forall] == % => [1 [3 6] [12 13] 15]
Scheme どう書く?的 - higepon blog を PostScript で
[1 3 4 5 6 12 13 15] [exch{ 1 index type /arraytype eq{ dup 1 sub 2 index 1 get eq{ 2 copy 1 exch put pop }if }{ 2 copy 1 sub eq{ 2 array astore }if }ifelse }forall] == % => [1 [3 6] [12 13] 15]