chickadee » prcc » join+

join+ PARSER0 PARSER1procedure

Repeat PARSER0 one or more times, interspersed by PARSER1.

Example:

;; Parse an array of "a" or "b" identifiers:
;; This can be done more elegantly with rep+_
(define ident (sel (char #\a) (char #\b)))

(parse-string
   "[a,b,b,a]"
   (even (ind (seq (char #\[) (join+ ident (char #\,)) (char #\])) 1)))

=> ("a" "b" "b" "a")