A functorial semantics for multi-algebras and partial algebras, with applications to syntax