Implement union() and intersection() functions.

Fixes #5801
Add special cases for Array and Dictionary in Value::GetTypeName().

Refs #5804