RosettaCodeData/Task/Range-extraction/Phixmonti/range-extraction-4.phixmonti
2023-07-01 13:44:08 -04:00

39 lines
683 B
Text

include ..\Utilitys.pmt
def glue /# l o -- l #/
var ob
len 2 * 1 - 2 swap 2 3 tolist for
ob swap put
endfor
enddef
( )
( 0 1 2 4 6 7 8 11 12 14
15 16 17 18 19 20 21 22 23 24
25 27 28 29 30 31 32 33 35 36
37 38 39 )
len for drop
pop swap dup var N var M
len for drop
head M 1 + == if
pop swap var M
else
exitfor
endif
endfor
swap
N M == if N tostr 0 put else
N 1 + M == if N tostr 0 put M tostr 0 put else
N tostr "-" M tostr chain chain 0 put
endif
endif
swap
len 0 == if
drop
exitfor
endif
endfor
"," glue lprint