code: def compare(array, other, op, ty_str):
      
      weld_obj = WeldObject(encoder_, decoder_)
  
      array_var = weld_obj.update(array)
      if isinstance(array, WeldObject):
          array_var = array.obj_id
          weld_obj.dependencies[array_var] = array
  
      # Strings need to be encoded into vec[char] array.
      # Constants can be added directly to NVL snippet.
      if isinstance(other, str) or isinstance(other, WeldObject):
          other_var = weld_obj.update(other)
          if isinstance(other, WeldObject):
              other_var = tmp.obj_id
              weld_obj.dependencies[other_var] = other
      else:
          other_var = "%s(%s)" % (ty_str, str(other))
  
      weld_template = """
         map(
           %(array)s,
           |a: %(ty)s| a %(op)s %(other)s
         )
      """
      weld_obj.weld_code = weld_template % {"array": array_var,
                                            "other": other_var,
                                            "op": op, "ty": ty_str}
  
      return weld_obj
docs: Performs passed-in comparison op between every element in the passed-in
      array and other, and returns an array of booleans.
  
      Args:
          array (WeldObject / Numpy.ndarray): Input array
          other (WeldObject / Numpy.ndarray): Second input array
          op (str): Op string used for element-wise comparison (== >= <= !=)
          ty (WeldType): Type of each element in the input array
  
      Returns:
          A WeldObject representing this computation