17 lines
364 B
Text
17 lines
364 B
Text
(define (foo txt)
|
|
(flat
|
|
(map
|
|
(fn(s)
|
|
(if (regex {^(-?\d+)-(-?\d+)} s)
|
|
(sequence (int $1) (int $2))
|
|
(int s)))
|
|
(parse (trim txt) ","))))
|
|
|
|
(foo "-6,-3--1,3-5,7-11,14,15,17-20")
|
|
|
|
(-6 -3 -2 -1 3 4 5 7 8 9 10 11 14 15 17 18 19 20)
|
|
|
|
|
|
(foo "-6,-3-1,3-5,7-11,14,15,17-20")
|
|
|
|
(-6 -3 -2 -1 0 1 3 4 5 7 8 9 10 11 14 15 17 18 19 20)
|