keep
  1. pat

When called on a pattern a, with a input pattern b (a.keep(b)), combines a and b such that anything defined in a, and anything defined in b that is not defined in a will be in the resulting pattern

The structure is maintained from a, because the default pattern alignment is in, see the section on Pattern Alignment in the technical manual in the docs

This is the inverse of set

See examples below

// notes, already defined, will stay "c a f e",
// while "s", not defined, will be set to "piano"
note("c a f e").keep(note("e f a c").s("piano"))
parametertype
pat
returns
mentioned in (1)