Type parameters let one function work with several concrete types while the compiler still checks how values are used. A constraint lists the operations the function can depend on. comparable allows equality and map keys; a union of numeric types allows the arithmetic those types share. A tilde includes named types whose underlying type matches the term. Use a generic function when several types need the same behavior, rather than replacing every simple function with type parameters. These exercises keep the result type intact while selecting, copying and counting values. Empty inputs expose the zero value of a type parameter, so return a separate presence flag when the caller needs to distinguish absence. The editor uses the official compiler, including generic standard-library packages.
Preserve the concrete string type.