Select a single vector from the struct of vectors.

    Parameters
    ----------
    struct_of_vec : WeldObject
        Encoding a struct of vectors.
    index_to_select : int
        Which vec to select from the struct.

    Returns
    -------
    WeldObject
        Representation of this computation.

def weld_select_from_struct(struct_of_vec, index_to_select):
    """Select a single vector from the struct of vectors.

    Parameters
    ----------
    struct_of_vec : WeldObject
        Encoding a struct of vectors.
    index_to_select : int
        Which vec to select from the struct.

    Returns
    -------
    WeldObject
        Representation of this computation.

    """
    obj_id, weld_obj = create_weld_object(struct_of_vec)

    weld_template = '{struct}.${index}'

    weld_obj.weld_code = weld_template.format(struct=obj_id,
                                              index=index_to_select)

    return weld_obj