def make_setidx_fn(self, lhs_array_type, 
                             rhs_value_type, 
                             fixed_positions, 
                             slice_positions):
    fixed_positions = tuple(fixed_positions)
    slice_positions = tuple(slice_positions)
    key = lhs_array_type, rhs_value_type, fixed_positions, slice_positions
    if key in self._setidx_cache: 
      return self._setidx_cache[key]

    
    n_fixed_indices = len(fixed_positions)
    n_parfor_indices = len(slice_positions)
    n_indices = n_fixed_indices + n_parfor_indices
    parfor_idx_t = repeat_tuple(Int64, n_parfor_indices) if n_parfor_indices > 1 else Int64 
    fixed_index_types = [Int64] * n_fixed_indices
    slice_start_types = [Int64] * n_parfor_indices
    slice_step_types = [Int64] * n_parfor_indices
    input_types = [lhs_array_type, rhs_value_type] + fixed_index_types + \
      slice_start_types + slice_step_types + [parfor_idx_t]
    name = "setidx_array%d_%s_par%d" % \
      (lhs_array_type.rank, lhs_array_type.elt_type, n_parfor_indices)
      
    #build_fn
    # Inputs:  
    #  - input_types
    #  - return_type=NoneType
    #  - name=None
    #  - input_names=None
    # Outputs:
    #  f, builder, input_vars 
    idx_names = ["idx%d" % (i+1) for i in xrange(n_fixed_indices)]
    start_names = ["start%d" % (i+1) for i in xrange(n_parfor_indices)]
    step_names = ["step%d" % (i+1) for i in xrange(n_parfor_indices)]
    
    input_names = ["output_array", "input_array"] + idx_names + start_names + step_names + ["sliceidx"]
    
    fn, builder, input_vars = build_fn(input_types, NoneType, name, input_names)
    lhs = input_vars[0]
    rhs = input_vars[1]
    fixed_indices = input_vars[2:(2+n_fixed_indices)]
    starts = input_vars[(2+n_fixed_indices):(2+n_fixed_indices+n_parfor_indices)]
    steps = input_vars[(2+n_fixed_indices+n_parfor_indices):(2+n_fixed_indices+2*n_parfor_indices)]
    assert (2+n_fixed_indices+2*n_parfor_indices+1) == len(input_vars), \
      "Wrong number of vars: %s, expected %d but got %d" % \
      (input_vars, 2+n_fixed_indices+2*n_parfor_indices+1, len(input_vars))
    parfor_idx = input_vars[-1]
    if n_parfor_indices > 1:
      parfor_indices = builder.tuple_elts(parfor_idx)
    else:
      parfor_indices = [parfor_idx]
    
    indices = []   
    # interleave the fixed and slice indices in their appropriate order
    # This would be easier if I had OCaml cons lists!
    slice_counter = 0
    fixed_counter = 0
    for i in xrange(n_indices):
      if fixed_counter < len(fixed_positions)  and i == fixed_positions[fixed_counter]:
        indices.append(fixed_indices[fixed_counter])
        fixed_counter += 1 
      else:
        assert slice_counter != len(slice_positions)  and slice_positions[slice_counter] == i, \
          "Bad positions for indices, missing %d" % i  
        start = starts[slice_counter]
        step = steps[slice_counter]
        parfor_idx = parfor_indices[slice_counter]
        indices.append(builder.add(start, builder.mul(step, parfor_idx)))
        slice_counter += 1
    
    value = builder.index(rhs, parfor_indices)
    builder.setidx(lhs, builder.tuple(indices), value)
    builder.return_(none)
    self._setidx_cache[key] = fn
    return fn
dataset/ETHPy150Open iskandr/parakeet/parakeet/transforms/lower_slices.py/LowerSlices.make_setidx_fn/operator `<` -> `!=`