<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def weld_cast_array(array, weld_type, to_weld_type):
 """Cast array to a different type. Parameters array : numpy.ndarray or WeldObject Input data. weld_type : WeldType Type of each element in the input array. to_weld_type : WeldType Desired type. Returns ------- WeldObject Representation of this computation. """

    if not is_numeric(weld_type) or not is_numeric(to_weld_type):
        raise TypeError('Cannot cast array of type={} to type={}'.format(weld_type, to_weld_type))

    obj_id, weld_obj = create_weld_object(array)

    weld_template = """map(
    {array},
    |e: {type}|
        {to}(e)
)"""

    weld_obj.weld_code = weld_template.format(array=obj_id,
                                              type=weld_type,
                                              to=to_weld_type)

    return weld_obj