Using the 'match' form, is there a straightforward way to have optional
items in a pattern?  For example:

(match records [(list (? string? name) 0..1  phone-numbers ..1) 'ok])

This would match a list of phone numbers that might or might not have the
owner's name (either as a single string or as two strings) on the front.

I know that I could do it with an 'or' pattern, or by having multiple
clauses in the match, but those get repetitive and verbose when part of the
pattern is a struct* used for decomposing multiple fields of a (potentially
nested) struct, which is a thing I do a lot.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAE8gKoer56g25tuAV0oa%2BQA_HGmRaWosgA5WQO3Lu5Pd74OtwQ%40mail.gmail.com.

Reply via email to