> By definition submatches 1 and 2 exist when RES is true. > Thus, I’d remove ‘safe-match:substring->number’ and do: > (match (string-match "^([0-9]+)\\.\\.([0-9]+)$" str) > (#f #f) > (matches > (let ((start (number->string (match:substring matches 1))) > (end (number->string (match:substring matches 2)))) > ...))) Done. > Probably this can reduce to a big ‘cond’, which would be even more > readable: > (cond ((maybe-integer) > => > list) > ((string-match "^([0-9]+)\\.\\.([0-9]+)$" str) > => > (lambda (match) > ...)) > ...) Are you sure? I haven’t found a way to make ‘cond’ as readable as ‘or’. I’m attaching a sketchy version. If you don’t see any problems, I’ll try to integrate this code into ‘package.scm’. (Something is wrong with the store on my machine, so I can’t properly test the filtering part. But I’ll do it as soon as possible.)