Reduce function

Creating reduce function which converts a list to a single scalar or complex value.