Custom identity function support

Introduces third optional argument to `concat()` — identity function.

If omitted, everything works as before. If specified, it used instead
of plain values. Allows to use with arrays of objects with
sophisticated identity calculation logic.