lib/berkeley_library/util/arrays.rb
# Given two lists, one of which is a superset of the other, with elements
# in the same order (but possibly with additional elements in the superset),
# returns an array the length of the subset, containing for each element in
# the subset the index of the corresponding element in the superset.
#
# @overload find_matching_indices(for_array:, in_array:)
#   For each value in `for_array`, finds the index of the first equal value
#   in `in_array` after the previously matched value.
#   @param in_array [Array] the list of values to look in
#   @param for_array [Array] the values to look for
#   @return [Array<Integer>, nil] the indices in `in_array` of each value in `for_array`,
#     or `nil` if not all values could be found
#
# @overload find_matching_indices(for_array:, in_array:)
#   For each value in `for_array`, finds the index of the first value
#   in `in_array` after the previously matched value that matches
#   the specified match function.
#   @param in_array [Array] the list of values to look in
#   @param for_array [Array] the values to look for
#   @yieldparam source [Object] the value to compare
#   @yieldparam target [Object] the value to compare against
#   @return [Array<Integer>, nil] the indices in `in_array` of each value in `for_array`,
#     or `nil` if not all values could be found
Given two lists, one of which is a superset of the other, with elements
in the same order (but possibly with additional elements in the superset),
returns an array the length of the subset, containing for each element in
the subset the index of the corresponding element in the superset.
Given two lists one of which is a superset of the other with elements in the same order ( but possibly with additional elements in the superset ) returns an array the length of the subset containing for each element in the subset the index of the corresponding element in the superset .
def find_indices(for_array:, in_array:, &block)
        return find_indices_matching(for_array, in_array, &block) if block_given?
        find_all_indices(for_array, in_array)
      end
def find_indices ( for_array : , in_array : , & block ) return find_indices_matching ( for_array , in_array , & block ) if block_given? find_all_indices ( for_array , in_array ) end
Given two lists, one of which is a superset of the other, with elements
in the same order (but possibly with additional elements in the superset),
returns an array the length of the subset, containing for each element in
the subset the index of the corresponding element in the superset.
Given two lists one of which is a superset of the other with elements in the same order ( but possibly with additional elements in the superset ) returns an array the length of the subset containing for each element in the subset the index of the corresponding element in the superset .
for_array
<not_specific>
in_array
<not_specific>
block
<not_specific>
overload
, in_array:) For each value in `for_array`, finds the index of the first equal value in `in_array` after the previously matched value. @param in_array [Array] the list of values to look in @param for_array [Array] the values to look for @return [Array, nil] the indices in `in_array` of each value in `for_array`, or `nil` if not all values could be found
in_array : ) For each value in ` for_array ` finds the index of the first equal value in ` in_array ` after the previously matched value . @param in_array [ Array ] the list of values to look in @param for_array [ Array ] the values to look for @return [ Array nil ] the indices in ` in_array ` of each value in ` for_array ` or ` nil ` if not all values could be found
overload
, in_array:) For each value in `for_array`, finds the index of the first value in `in_array` after the previously matched value that matches the specified match function. @param in_array [Array] the list of values to look in @param for_array [Array] the values to look for @yieldparam source [Object] the value to compare @yieldparam target [Object] the value to compare against @return [Array, nil] the indices in `in_array` of each value in `for_array`, or `nil` if not all values could be found
in_array : ) For each value in ` for_array ` finds the index of the first value in ` in_array ` after the previously matched value that matches the specified match function . @param in_array [ Array ] the list of values to look in @param for_array [ Array ] the values to look for @yieldparam source [ Object ] the value to compare @yieldparam target [ Object ] the value to compare against @return [ Array nil ] the indices in ` in_array ` of each value in ` for_array ` or ` nil ` if not all values could be found