Sha256: 4dd1e42569b872bba723e3fd51711ef936274432a9741eb5c8af1ca82ecaef34
Contents?: true
Size: 342 Bytes
Versions: 34
Compression:
Stored size: 342 Bytes
Contents
#!/usr/bin/env ruby # frozen_string_literal: true # encoding=utf-8 module ArrayUtil def self.partition_by_predicate(arr) true_list = [] false_list = [] arr.each do |element| if yield(element) true_list << element else false_list << element end end [true_list, false_list] end end
Version data entries
34 entries across 34 versions & 1 rubygems