immutable-ruby 0.0.4 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/immutable/core_ext/enumerable.rb +1 -1
- data/lib/immutable/core_ext/io.rb +1 -1
- data/lib/immutable/core_ext.rb +2 -2
- data/lib/immutable/deque.rb +17 -17
- data/lib/immutable/enumerable.rb +10 -10
- data/lib/immutable/hash.rb +24 -24
- data/lib/immutable/list.rb +36 -36
- data/lib/immutable/nested.rb +8 -8
- data/lib/immutable/set.rb +30 -30
- data/lib/immutable/sorted_set.rb +30 -26
- data/lib/immutable/trie.rb +2 -2
- data/lib/immutable/vector.rb +40 -35
- data/lib/immutable/version.rb +1 -1
- data/lib/immutable.rb +9 -9
- metadata +36 -699
- data/lib/immutable/core_ext/struct.rb +0 -9
- data/spec/fixtures/io_spec.txt +0 -3
- data/spec/lib/immutable/core_ext/array_spec.rb +0 -13
- data/spec/lib/immutable/core_ext/enumerable_spec.rb +0 -29
- data/spec/lib/immutable/core_ext/io_spec.rb +0 -28
- data/spec/lib/immutable/deque/clear_spec.rb +0 -33
- data/spec/lib/immutable/deque/construction_spec.rb +0 -29
- data/spec/lib/immutable/deque/copying_spec.rb +0 -19
- data/spec/lib/immutable/deque/dequeue_spec.rb +0 -34
- data/spec/lib/immutable/deque/empty_spec.rb +0 -39
- data/spec/lib/immutable/deque/enqueue_spec.rb +0 -27
- data/spec/lib/immutable/deque/first_spec.rb +0 -17
- data/spec/lib/immutable/deque/inspect_spec.rb +0 -23
- data/spec/lib/immutable/deque/last_spec.rb +0 -17
- data/spec/lib/immutable/deque/marshal_spec.rb +0 -33
- data/spec/lib/immutable/deque/new_spec.rb +0 -43
- data/spec/lib/immutable/deque/pop_spec.rb +0 -36
- data/spec/lib/immutable/deque/pretty_print_spec.rb +0 -23
- data/spec/lib/immutable/deque/push_spec.rb +0 -36
- data/spec/lib/immutable/deque/random_modification_spec.rb +0 -33
- data/spec/lib/immutable/deque/rotate_spec.rb +0 -68
- data/spec/lib/immutable/deque/shift_spec.rb +0 -29
- data/spec/lib/immutable/deque/size_spec.rb +0 -19
- data/spec/lib/immutable/deque/to_a_spec.rb +0 -26
- data/spec/lib/immutable/deque/to_ary_spec.rb +0 -35
- data/spec/lib/immutable/deque/to_list_spec.rb +0 -24
- data/spec/lib/immutable/deque/unshift_spec.rb +0 -30
- data/spec/lib/immutable/hash/all_spec.rb +0 -53
- data/spec/lib/immutable/hash/any_spec.rb +0 -53
- data/spec/lib/immutable/hash/assoc_spec.rb +0 -51
- data/spec/lib/immutable/hash/clear_spec.rb +0 -42
- data/spec/lib/immutable/hash/construction_spec.rb +0 -38
- data/spec/lib/immutable/hash/copying_spec.rb +0 -13
- data/spec/lib/immutable/hash/default_proc_spec.rb +0 -72
- data/spec/lib/immutable/hash/delete_spec.rb +0 -39
- data/spec/lib/immutable/hash/dig_spec.rb +0 -34
- data/spec/lib/immutable/hash/each_spec.rb +0 -77
- data/spec/lib/immutable/hash/each_with_index_spec.rb +0 -29
- data/spec/lib/immutable/hash/empty_spec.rb +0 -43
- data/spec/lib/immutable/hash/eql_spec.rb +0 -75
- data/spec/lib/immutable/hash/except_spec.rb +0 -42
- data/spec/lib/immutable/hash/fetch_spec.rb +0 -57
- data/spec/lib/immutable/hash/fetch_values_spec.rb +0 -22
- data/spec/lib/immutable/hash/find_spec.rb +0 -43
- data/spec/lib/immutable/hash/flat_map_spec.rb +0 -35
- data/spec/lib/immutable/hash/flatten_spec.rb +0 -98
- data/spec/lib/immutable/hash/get_spec.rb +0 -79
- data/spec/lib/immutable/hash/has_key_spec.rb +0 -31
- data/spec/lib/immutable/hash/has_value_spec.rb +0 -27
- data/spec/lib/immutable/hash/hash_spec.rb +0 -29
- data/spec/lib/immutable/hash/inspect_spec.rb +0 -30
- data/spec/lib/immutable/hash/invert_spec.rb +0 -30
- data/spec/lib/immutable/hash/key_spec.rb +0 -27
- data/spec/lib/immutable/hash/keys_spec.rb +0 -15
- data/spec/lib/immutable/hash/map_spec.rb +0 -45
- data/spec/lib/immutable/hash/marshal_spec.rb +0 -28
- data/spec/lib/immutable/hash/merge_spec.rb +0 -82
- data/spec/lib/immutable/hash/min_max_spec.rb +0 -45
- data/spec/lib/immutable/hash/new_spec.rb +0 -70
- data/spec/lib/immutable/hash/none_spec.rb +0 -48
- data/spec/lib/immutable/hash/partition_spec.rb +0 -35
- data/spec/lib/immutable/hash/pretty_print_spec.rb +0 -34
- data/spec/lib/immutable/hash/put_spec.rb +0 -111
- data/spec/lib/immutable/hash/reduce_spec.rb +0 -35
- data/spec/lib/immutable/hash/reject_spec.rb +0 -61
- data/spec/lib/immutable/hash/reverse_each_spec.rb +0 -27
- data/spec/lib/immutable/hash/sample_spec.rb +0 -13
- data/spec/lib/immutable/hash/select_spec.rb +0 -57
- data/spec/lib/immutable/hash/size_spec.rb +0 -51
- data/spec/lib/immutable/hash/slice_spec.rb +0 -44
- data/spec/lib/immutable/hash/sort_spec.rb +0 -26
- data/spec/lib/immutable/hash/store_spec.rb +0 -75
- data/spec/lib/immutable/hash/subset_spec.rb +0 -42
- data/spec/lib/immutable/hash/superset_spec.rb +0 -42
- data/spec/lib/immutable/hash/take_spec.rb +0 -35
- data/spec/lib/immutable/hash/to_a_spec.rb +0 -13
- data/spec/lib/immutable/hash/to_hash_spec.rb +0 -21
- data/spec/lib/immutable/hash/to_proc_spec.rb +0 -39
- data/spec/lib/immutable/hash/update_in_spec.rb +0 -79
- data/spec/lib/immutable/hash/values_at_spec.rb +0 -33
- data/spec/lib/immutable/hash/values_spec.rb +0 -23
- data/spec/lib/immutable/list/add_spec.rb +0 -25
- data/spec/lib/immutable/list/all_spec.rb +0 -57
- data/spec/lib/immutable/list/any_spec.rb +0 -49
- data/spec/lib/immutable/list/append_spec.rb +0 -38
- data/spec/lib/immutable/list/at_spec.rb +0 -29
- data/spec/lib/immutable/list/break_spec.rb +0 -69
- data/spec/lib/immutable/list/cadr_spec.rb +0 -38
- data/spec/lib/immutable/list/chunk_spec.rb +0 -28
- data/spec/lib/immutable/list/clear_spec.rb +0 -24
- data/spec/lib/immutable/list/combination_spec.rb +0 -33
- data/spec/lib/immutable/list/compact_spec.rb +0 -34
- data/spec/lib/immutable/list/compare_spec.rb +0 -30
- data/spec/lib/immutable/list/cons_spec.rb +0 -25
- data/spec/lib/immutable/list/construction_spec.rb +0 -110
- data/spec/lib/immutable/list/copying_spec.rb +0 -19
- data/spec/lib/immutable/list/count_spec.rb +0 -36
- data/spec/lib/immutable/list/cycle_spec.rb +0 -28
- data/spec/lib/immutable/list/delete_at_spec.rb +0 -18
- data/spec/lib/immutable/list/delete_spec.rb +0 -16
- data/spec/lib/immutable/list/drop_spec.rb +0 -30
- data/spec/lib/immutable/list/drop_while_spec.rb +0 -38
- data/spec/lib/immutable/list/each_slice_spec.rb +0 -51
- data/spec/lib/immutable/list/each_spec.rb +0 -40
- data/spec/lib/immutable/list/each_with_index_spec.rb +0 -28
- data/spec/lib/immutable/list/empty_spec.rb +0 -23
- data/spec/lib/immutable/list/eql_spec.rb +0 -61
- data/spec/lib/immutable/list/fill_spec.rb +0 -49
- data/spec/lib/immutable/list/find_all_spec.rb +0 -70
- data/spec/lib/immutable/list/find_index_spec.rb +0 -35
- data/spec/lib/immutable/list/find_spec.rb +0 -42
- data/spec/lib/immutable/list/flat_map_spec.rb +0 -51
- data/spec/lib/immutable/list/flatten_spec.rb +0 -30
- data/spec/lib/immutable/list/grep_spec.rb +0 -46
- data/spec/lib/immutable/list/group_by_spec.rb +0 -41
- data/spec/lib/immutable/list/hash_spec.rb +0 -21
- data/spec/lib/immutable/list/head_spec.rb +0 -19
- data/spec/lib/immutable/list/include_spec.rb +0 -35
- data/spec/lib/immutable/list/index_spec.rb +0 -37
- data/spec/lib/immutable/list/indices_spec.rb +0 -61
- data/spec/lib/immutable/list/init_spec.rb +0 -28
- data/spec/lib/immutable/list/inits_spec.rb +0 -28
- data/spec/lib/immutable/list/insert_spec.rb +0 -46
- data/spec/lib/immutable/list/inspect_spec.rb +0 -29
- data/spec/lib/immutable/list/intersperse_spec.rb +0 -28
- data/spec/lib/immutable/list/join_spec.rb +0 -63
- data/spec/lib/immutable/list/last_spec.rb +0 -23
- data/spec/lib/immutable/list/ltlt_spec.rb +0 -19
- data/spec/lib/immutable/list/map_spec.rb +0 -45
- data/spec/lib/immutable/list/maximum_spec.rb +0 -39
- data/spec/lib/immutable/list/merge_by_spec.rb +0 -51
- data/spec/lib/immutable/list/merge_spec.rb +0 -59
- data/spec/lib/immutable/list/minimum_spec.rb +0 -39
- data/spec/lib/immutable/list/multithreading_spec.rb +0 -47
- data/spec/lib/immutable/list/none_spec.rb +0 -47
- data/spec/lib/immutable/list/one_spec.rb +0 -49
- data/spec/lib/immutable/list/partition_spec.rb +0 -115
- data/spec/lib/immutable/list/permutation_spec.rb +0 -55
- data/spec/lib/immutable/list/pop_spec.rb +0 -25
- data/spec/lib/immutable/list/product_spec.rb +0 -23
- data/spec/lib/immutable/list/reduce_spec.rb +0 -53
- data/spec/lib/immutable/list/reject_spec.rb +0 -45
- data/spec/lib/immutable/list/reverse_spec.rb +0 -34
- data/spec/lib/immutable/list/rotate_spec.rb +0 -36
- data/spec/lib/immutable/list/sample_spec.rb +0 -13
- data/spec/lib/immutable/list/select_spec.rb +0 -70
- data/spec/lib/immutable/list/size_spec.rb +0 -25
- data/spec/lib/immutable/list/slice_spec.rb +0 -229
- data/spec/lib/immutable/list/sorting_spec.rb +0 -46
- data/spec/lib/immutable/list/span_spec.rb +0 -76
- data/spec/lib/immutable/list/split_at_spec.rb +0 -43
- data/spec/lib/immutable/list/subsequences_spec.rb +0 -23
- data/spec/lib/immutable/list/sum_spec.rb +0 -23
- data/spec/lib/immutable/list/tail_spec.rb +0 -30
- data/spec/lib/immutable/list/tails_spec.rb +0 -28
- data/spec/lib/immutable/list/take_spec.rb +0 -30
- data/spec/lib/immutable/list/take_while_spec.rb +0 -46
- data/spec/lib/immutable/list/to_a_spec.rb +0 -39
- data/spec/lib/immutable/list/to_ary_spec.rb +0 -41
- data/spec/lib/immutable/list/to_list_spec.rb +0 -19
- data/spec/lib/immutable/list/to_set_spec.rb +0 -17
- data/spec/lib/immutable/list/transpose_spec.rb +0 -19
- data/spec/lib/immutable/list/union_spec.rb +0 -31
- data/spec/lib/immutable/list/uniq_spec.rb +0 -35
- data/spec/lib/immutable/list/zip_spec.rb +0 -23
- data/spec/lib/immutable/nested/construction_spec.rb +0 -101
- data/spec/lib/immutable/set/add_spec.rb +0 -77
- data/spec/lib/immutable/set/all_spec.rb +0 -51
- data/spec/lib/immutable/set/any_spec.rb +0 -51
- data/spec/lib/immutable/set/clear_spec.rb +0 -33
- data/spec/lib/immutable/set/compact_spec.rb +0 -30
- data/spec/lib/immutable/set/construction_spec.rb +0 -18
- data/spec/lib/immutable/set/copying_spec.rb +0 -13
- data/spec/lib/immutable/set/count_spec.rb +0 -36
- data/spec/lib/immutable/set/delete_spec.rb +0 -71
- data/spec/lib/immutable/set/difference_spec.rb +0 -49
- data/spec/lib/immutable/set/disjoint_spec.rb +0 -25
- data/spec/lib/immutable/set/each_spec.rb +0 -45
- data/spec/lib/immutable/set/empty_spec.rb +0 -44
- data/spec/lib/immutable/set/eqeq_spec.rb +0 -103
- data/spec/lib/immutable/set/eql_spec.rb +0 -109
- data/spec/lib/immutable/set/exclusion_spec.rb +0 -47
- data/spec/lib/immutable/set/find_spec.rb +0 -35
- data/spec/lib/immutable/set/first_spec.rb +0 -28
- data/spec/lib/immutable/set/flatten_spec.rb +0 -46
- data/spec/lib/immutable/set/grep_spec.rb +0 -57
- data/spec/lib/immutable/set/grep_v_spec.rb +0 -59
- data/spec/lib/immutable/set/group_by_spec.rb +0 -59
- data/spec/lib/immutable/set/hash_spec.rb +0 -22
- data/spec/lib/immutable/set/include_spec.rb +0 -60
- data/spec/lib/immutable/set/inspect_spec.rb +0 -47
- data/spec/lib/immutable/set/intersect_spec.rb +0 -25
- data/spec/lib/immutable/set/intersection_spec.rb +0 -52
- data/spec/lib/immutable/set/join_spec.rb +0 -64
- data/spec/lib/immutable/set/map_spec.rb +0 -59
- data/spec/lib/immutable/set/marshal_spec.rb +0 -28
- data/spec/lib/immutable/set/maximum_spec.rb +0 -36
- data/spec/lib/immutable/set/minimum_spec.rb +0 -36
- data/spec/lib/immutable/set/new_spec.rb +0 -53
- data/spec/lib/immutable/set/none_spec.rb +0 -47
- data/spec/lib/immutable/set/one_spec.rb +0 -47
- data/spec/lib/immutable/set/partition_spec.rb +0 -52
- data/spec/lib/immutable/set/product_spec.rb +0 -23
- data/spec/lib/immutable/set/reduce_spec.rb +0 -55
- data/spec/lib/immutable/set/reject_spec.rb +0 -50
- data/spec/lib/immutable/set/reverse_each_spec.rb +0 -38
- data/spec/lib/immutable/set/sample_spec.rb +0 -13
- data/spec/lib/immutable/set/select_spec.rb +0 -73
- data/spec/lib/immutable/set/size_spec.rb +0 -17
- data/spec/lib/immutable/set/sorting_spec.rb +0 -65
- data/spec/lib/immutable/set/subset_spec.rb +0 -51
- data/spec/lib/immutable/set/sum_spec.rb +0 -23
- data/spec/lib/immutable/set/superset_spec.rb +0 -51
- data/spec/lib/immutable/set/to_a_spec.rb +0 -30
- data/spec/lib/immutable/set/to_list_spec.rb +0 -35
- data/spec/lib/immutable/set/to_set_spec.rb +0 -19
- data/spec/lib/immutable/set/union_spec.rb +0 -63
- data/spec/lib/immutable/sorted_set/above_spec.rb +0 -51
- data/spec/lib/immutable/sorted_set/add_spec.rb +0 -62
- data/spec/lib/immutable/sorted_set/at_spec.rb +0 -24
- data/spec/lib/immutable/sorted_set/below_spec.rb +0 -51
- data/spec/lib/immutable/sorted_set/between_spec.rb +0 -51
- data/spec/lib/immutable/sorted_set/clear_spec.rb +0 -43
- data/spec/lib/immutable/sorted_set/copying_spec.rb +0 -20
- data/spec/lib/immutable/sorted_set/delete_at_spec.rb +0 -18
- data/spec/lib/immutable/sorted_set/delete_spec.rb +0 -89
- data/spec/lib/immutable/sorted_set/difference_spec.rb +0 -22
- data/spec/lib/immutable/sorted_set/disjoint_spec.rb +0 -25
- data/spec/lib/immutable/sorted_set/drop_spec.rb +0 -55
- data/spec/lib/immutable/sorted_set/drop_while_spec.rb +0 -34
- data/spec/lib/immutable/sorted_set/each_spec.rb +0 -28
- data/spec/lib/immutable/sorted_set/empty_spec.rb +0 -34
- data/spec/lib/immutable/sorted_set/eql_spec.rb +0 -120
- data/spec/lib/immutable/sorted_set/exclusion_spec.rb +0 -22
- data/spec/lib/immutable/sorted_set/fetch_spec.rb +0 -64
- data/spec/lib/immutable/sorted_set/find_index_spec.rb +0 -40
- data/spec/lib/immutable/sorted_set/first_spec.rb +0 -18
- data/spec/lib/immutable/sorted_set/from_spec.rb +0 -51
- data/spec/lib/immutable/sorted_set/group_by_spec.rb +0 -57
- data/spec/lib/immutable/sorted_set/include_spec.rb +0 -23
- data/spec/lib/immutable/sorted_set/inspect_spec.rb +0 -37
- data/spec/lib/immutable/sorted_set/intersect_spec.rb +0 -25
- data/spec/lib/immutable/sorted_set/intersection_spec.rb +0 -28
- data/spec/lib/immutable/sorted_set/last_spec.rb +0 -36
- data/spec/lib/immutable/sorted_set/map_spec.rb +0 -51
- data/spec/lib/immutable/sorted_set/marshal_spec.rb +0 -36
- data/spec/lib/immutable/sorted_set/maximum_spec.rb +0 -36
- data/spec/lib/immutable/sorted_set/minimum_spec.rb +0 -19
- data/spec/lib/immutable/sorted_set/new_spec.rb +0 -137
- data/spec/lib/immutable/sorted_set/reverse_each_spec.rb +0 -28
- data/spec/lib/immutable/sorted_set/sample_spec.rb +0 -13
- data/spec/lib/immutable/sorted_set/select_spec.rb +0 -61
- data/spec/lib/immutable/sorted_set/size_spec.rb +0 -17
- data/spec/lib/immutable/sorted_set/slice_spec.rb +0 -256
- data/spec/lib/immutable/sorted_set/sorting_spec.rb +0 -56
- data/spec/lib/immutable/sorted_set/subset_spec.rb +0 -47
- data/spec/lib/immutable/sorted_set/superset_spec.rb +0 -47
- data/spec/lib/immutable/sorted_set/take_spec.rb +0 -54
- data/spec/lib/immutable/sorted_set/take_while_spec.rb +0 -33
- data/spec/lib/immutable/sorted_set/to_set_spec.rb +0 -17
- data/spec/lib/immutable/sorted_set/union_spec.rb +0 -58
- data/spec/lib/immutable/sorted_set/up_to_spec.rb +0 -52
- data/spec/lib/immutable/sorted_set/util_spec.rb +0 -48
- data/spec/lib/immutable/sorted_set/values_at_spec.rb +0 -33
- data/spec/lib/immutable/vector/add_spec.rb +0 -67
- data/spec/lib/immutable/vector/any_spec.rb +0 -69
- data/spec/lib/immutable/vector/assoc_spec.rb +0 -45
- data/spec/lib/immutable/vector/bsearch_spec.rb +0 -65
- data/spec/lib/immutable/vector/clear_spec.rb +0 -33
- data/spec/lib/immutable/vector/combination_spec.rb +0 -81
- data/spec/lib/immutable/vector/compact_spec.rb +0 -29
- data/spec/lib/immutable/vector/compare_spec.rb +0 -31
- data/spec/lib/immutable/vector/concat_spec.rb +0 -34
- data/spec/lib/immutable/vector/copying_spec.rb +0 -20
- data/spec/lib/immutable/vector/count_spec.rb +0 -17
- data/spec/lib/immutable/vector/delete_at_spec.rb +0 -53
- data/spec/lib/immutable/vector/delete_spec.rb +0 -30
- data/spec/lib/immutable/vector/dig_spec.rb +0 -30
- data/spec/lib/immutable/vector/drop_spec.rb +0 -41
- data/spec/lib/immutable/vector/drop_while_spec.rb +0 -54
- data/spec/lib/immutable/vector/each_index_spec.rb +0 -40
- data/spec/lib/immutable/vector/each_spec.rb +0 -44
- data/spec/lib/immutable/vector/each_with_index_spec.rb +0 -39
- data/spec/lib/immutable/vector/empty_spec.rb +0 -41
- data/spec/lib/immutable/vector/eql_spec.rb +0 -76
- data/spec/lib/immutable/vector/fetch_spec.rb +0 -64
- data/spec/lib/immutable/vector/fill_spec.rb +0 -88
- data/spec/lib/immutable/vector/first_spec.rb +0 -18
- data/spec/lib/immutable/vector/flat_map_spec.rb +0 -50
- data/spec/lib/immutable/vector/flatten_spec.rb +0 -58
- data/spec/lib/immutable/vector/get_spec.rb +0 -74
- data/spec/lib/immutable/vector/group_by_spec.rb +0 -57
- data/spec/lib/immutable/vector/include_spec.rb +0 -30
- data/spec/lib/immutable/vector/insert_spec.rb +0 -68
- data/spec/lib/immutable/vector/inspect_spec.rb +0 -49
- data/spec/lib/immutable/vector/join_spec.rb +0 -58
- data/spec/lib/immutable/vector/last_spec.rb +0 -45
- data/spec/lib/immutable/vector/length_spec.rb +0 -45
- data/spec/lib/immutable/vector/ltlt_spec.rb +0 -65
- data/spec/lib/immutable/vector/map_spec.rb +0 -51
- data/spec/lib/immutable/vector/marshal_spec.rb +0 -31
- data/spec/lib/immutable/vector/maximum_spec.rb +0 -33
- data/spec/lib/immutable/vector/minimum_spec.rb +0 -33
- data/spec/lib/immutable/vector/multiply_spec.rb +0 -47
- data/spec/lib/immutable/vector/new_spec.rb +0 -50
- data/spec/lib/immutable/vector/partition_spec.rb +0 -52
- data/spec/lib/immutable/vector/permutation_spec.rb +0 -91
- data/spec/lib/immutable/vector/pop_spec.rb +0 -26
- data/spec/lib/immutable/vector/product_spec.rb +0 -70
- data/spec/lib/immutable/vector/reduce_spec.rb +0 -55
- data/spec/lib/immutable/vector/reject_spec.rb +0 -43
- data/spec/lib/immutable/vector/repeated_combination_spec.rb +0 -77
- data/spec/lib/immutable/vector/repeated_permutation_spec.rb +0 -93
- data/spec/lib/immutable/vector/reverse_each_spec.rb +0 -31
- data/spec/lib/immutable/vector/reverse_spec.rb +0 -21
- data/spec/lib/immutable/vector/rindex_spec.rb +0 -36
- data/spec/lib/immutable/vector/rotate_spec.rb +0 -73
- data/spec/lib/immutable/vector/sample_spec.rb +0 -13
- data/spec/lib/immutable/vector/select_spec.rb +0 -63
- data/spec/lib/immutable/vector/set_spec.rb +0 -174
- data/spec/lib/immutable/vector/shift_spec.rb +0 -27
- data/spec/lib/immutable/vector/shuffle_spec.rb +0 -43
- data/spec/lib/immutable/vector/slice_spec.rb +0 -240
- data/spec/lib/immutable/vector/sorting_spec.rb +0 -56
- data/spec/lib/immutable/vector/sum_spec.rb +0 -17
- data/spec/lib/immutable/vector/take_spec.rb +0 -42
- data/spec/lib/immutable/vector/take_while_spec.rb +0 -34
- data/spec/lib/immutable/vector/to_a_spec.rb +0 -41
- data/spec/lib/immutable/vector/to_ary_spec.rb +0 -34
- data/spec/lib/immutable/vector/to_list_spec.rb +0 -30
- data/spec/lib/immutable/vector/to_set_spec.rb +0 -21
- data/spec/lib/immutable/vector/transpose_spec.rb +0 -48
- data/spec/lib/immutable/vector/uniq_spec.rb +0 -76
- data/spec/lib/immutable/vector/unshift_spec.rb +0 -28
- data/spec/lib/immutable/vector/update_in_spec.rb +0 -82
- data/spec/lib/immutable/vector/values_at_spec.rb +0 -33
- data/spec/lib/immutable/vector/zip_spec.rb +0 -57
- data/spec/lib/load_spec.rb +0 -42
- data/spec/spec_helper.rb +0 -96
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54e4768953f4e1a9afbfc0d8496bdb563ae850419c905ea4dce78b560c88da3c
|
4
|
+
data.tar.gz: 9237a022ed3107aad98adfaed510cbd4b76367b06aab7a2d6a1f8dc2d6d3c911
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7aa2208347fcce032af7b0885cb5088ea7d93573dd54c59fbebf7d98bd962be8880533c3c0fabe92fb7cfc5eddf1a9cc06cb60a0180ee55507d09dde7b2a0396
|
7
|
+
data.tar.gz: f10991e1881c42941d9723eb0acc569126b06716273852089c7f25a3bf2e5fefc25e1d5c767682dbb75d88a52da9dc12aee90627c7e1a92cf513f586aab3ef42
|
data/lib/immutable/core_ext.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'immutable/core_ext/enumerable'
|
2
|
+
require 'immutable/core_ext/io'
|
data/lib/immutable/deque.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'immutable/list'
|
2
2
|
|
3
3
|
module Immutable
|
4
4
|
|
@@ -48,7 +48,7 @@ module Immutable
|
|
48
48
|
#
|
49
49
|
# @return [Deque]
|
50
50
|
def empty
|
51
|
-
@empty ||=
|
51
|
+
@empty ||= new
|
52
52
|
end
|
53
53
|
|
54
54
|
# "Raw" allocation of a new `Deque`. Used internally to create a new
|
@@ -86,7 +86,7 @@ module Immutable
|
|
86
86
|
def size
|
87
87
|
@front.size + @rear.size
|
88
88
|
end
|
89
|
-
alias
|
89
|
+
alias length size
|
90
90
|
|
91
91
|
# Return the first item in the `Deque`. If the deque is empty, return `nil`.
|
92
92
|
#
|
@@ -122,9 +122,9 @@ module Immutable
|
|
122
122
|
# @param n [Integer] number of positions to move elements by
|
123
123
|
# @return [Deque]
|
124
124
|
def rotate(n)
|
125
|
-
return self.class.empty if
|
125
|
+
return self.class.empty if empty?
|
126
126
|
|
127
|
-
n %=
|
127
|
+
n %= size
|
128
128
|
return self if n == 0
|
129
129
|
|
130
130
|
a, b = @front, @rear
|
@@ -132,7 +132,7 @@ module Immutable
|
|
132
132
|
if b.size >= n
|
133
133
|
n.times { a = a.cons(b.head); b = b.tail }
|
134
134
|
else
|
135
|
-
(
|
135
|
+
(size - n).times { b = b.cons(a.head); a = a.tail }
|
136
136
|
end
|
137
137
|
|
138
138
|
self.class.alloc(a, b)
|
@@ -149,7 +149,7 @@ module Immutable
|
|
149
149
|
def push(item)
|
150
150
|
self.class.alloc(@front, @rear.cons(item))
|
151
151
|
end
|
152
|
-
alias
|
152
|
+
alias enqueue push
|
153
153
|
|
154
154
|
# Return a new `Deque` with the last item removed.
|
155
155
|
#
|
@@ -198,7 +198,7 @@ module Immutable
|
|
198
198
|
|
199
199
|
self.class.alloc(front.tail, rear)
|
200
200
|
end
|
201
|
-
alias
|
201
|
+
alias dequeue shift
|
202
202
|
|
203
203
|
# Return an empty `Deque` instance, of the same class as this one. Useful if you
|
204
204
|
# have multiple subclasses of `Deque` and want to treat them polymorphically.
|
@@ -223,15 +223,15 @@ module Immutable
|
|
223
223
|
return true if other.equal?(self)
|
224
224
|
instance_of?(other.class) && to_ary.eql?(other.to_ary)
|
225
225
|
end
|
226
|
-
alias
|
226
|
+
alias == eql?
|
227
227
|
|
228
228
|
# Return an `Array` with the same elements, in the same order.
|
229
229
|
# @return [Array]
|
230
230
|
def to_a
|
231
|
-
@front.to_a.concat(@rear.to_a.tap
|
231
|
+
@front.to_a.concat(@rear.to_a.tap(&:reverse!))
|
232
232
|
end
|
233
|
-
alias
|
234
|
-
alias
|
233
|
+
alias entries to_a
|
234
|
+
alias to_ary to_a
|
235
235
|
|
236
236
|
# Return a {List} with the same elements, in the same order.
|
237
237
|
# @return [Immutable::List]
|
@@ -248,8 +248,8 @@ module Immutable
|
|
248
248
|
result = "#{self.class}["
|
249
249
|
i = 0
|
250
250
|
@front.each { |obj| result << ', ' if i > 0; result << obj.inspect; i += 1 }
|
251
|
-
@rear.to_a.tap
|
252
|
-
result <<
|
251
|
+
@rear.to_a.tap(&:reverse!).each { |obj| result << ', ' if i > 0; result << obj.inspect; i += 1 }
|
252
|
+
result << ']'
|
253
253
|
end
|
254
254
|
|
255
255
|
# Return `self`. Since this is an immutable object duplicates are
|
@@ -258,13 +258,13 @@ module Immutable
|
|
258
258
|
def dup
|
259
259
|
self
|
260
260
|
end
|
261
|
-
alias
|
261
|
+
alias clone dup
|
262
262
|
|
263
263
|
# @private
|
264
264
|
def pretty_print(pp)
|
265
|
-
pp.group(1, "#{self.class}[",
|
265
|
+
pp.group(1, "#{self.class}[", ']') do
|
266
266
|
pp.breakable ''
|
267
|
-
pp.seplist(
|
267
|
+
pp.seplist(to_a) { |obj| obj.pretty_print(pp) }
|
268
268
|
end
|
269
269
|
end
|
270
270
|
|
data/lib/immutable/enumerable.rb
CHANGED
@@ -15,7 +15,7 @@ module Immutable
|
|
15
15
|
return enum_for(:reject) if not block_given?
|
16
16
|
select { |item| !yield(item) }
|
17
17
|
end
|
18
|
-
alias
|
18
|
+
alias delete_if reject
|
19
19
|
|
20
20
|
# Return a new collection with all `nil` elements removed.
|
21
21
|
def compact
|
@@ -91,15 +91,15 @@ module Immutable
|
|
91
91
|
# Compare with `other`, and return 0, 1, or -1 if it is (respectively) equal to,
|
92
92
|
# greater than, or less than this collection.
|
93
93
|
def <=>(other)
|
94
|
-
return 0 if
|
95
|
-
enum1, enum2 =
|
94
|
+
return 0 if equal?(other)
|
95
|
+
enum1, enum2 = to_enum, other.to_enum
|
96
96
|
loop do
|
97
97
|
item1 = enum1.next
|
98
98
|
item2 = enum2.next
|
99
99
|
comp = (item1 <=> item2)
|
100
100
|
return comp if comp != 0
|
101
101
|
end
|
102
|
-
size1, size2 =
|
102
|
+
size1, size2 = size, other.size
|
103
103
|
return 0 if size1 == size2
|
104
104
|
size1 > size2 ? 1 : -1
|
105
105
|
end
|
@@ -107,14 +107,14 @@ module Immutable
|
|
107
107
|
# Return true if `other` contains the same elements, in the same order.
|
108
108
|
# @return [Boolean]
|
109
109
|
def ==(other)
|
110
|
-
|
110
|
+
eql?(other) || (other.respond_to?(:to_ary) && to_ary == other.to_ary)
|
111
111
|
end
|
112
112
|
|
113
113
|
# Convert all the elements into strings and join them together, separated by
|
114
114
|
# `separator`. By default, the `separator` is `$,`, the global default string
|
115
115
|
# separator, which is normally `nil`.
|
116
116
|
def join(separator = $,)
|
117
|
-
result =
|
117
|
+
result = ''
|
118
118
|
if separator
|
119
119
|
each_with_index { |obj, i| result << separator if i > 0; result << obj.to_s }
|
120
120
|
else
|
@@ -132,19 +132,19 @@ module Immutable
|
|
132
132
|
def inspect
|
133
133
|
result = "#{self.class}["
|
134
134
|
each_with_index { |obj, i| result << ', ' if i > 0; result << obj.inspect }
|
135
|
-
result <<
|
135
|
+
result << ']'
|
136
136
|
end
|
137
137
|
|
138
138
|
# @private
|
139
139
|
def pretty_print(pp)
|
140
|
-
pp.group(1, "#{self.class}[",
|
140
|
+
pp.group(1, "#{self.class}[", ']') do
|
141
141
|
pp.breakable ''
|
142
142
|
pp.seplist(self) { |obj| obj.pretty_print(pp) }
|
143
143
|
end
|
144
144
|
end
|
145
145
|
|
146
|
-
alias
|
147
|
-
alias
|
146
|
+
alias to_ary to_a
|
147
|
+
alias index find_index
|
148
148
|
|
149
149
|
## Compatibility fixes
|
150
150
|
|
data/lib/immutable/hash.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
1
|
+
require 'immutable/undefined'
|
2
|
+
require 'immutable/enumerable'
|
3
|
+
require 'immutable/trie'
|
4
|
+
require 'immutable/set'
|
5
|
+
require 'immutable/vector'
|
6
6
|
|
7
7
|
module Immutable
|
8
8
|
|
@@ -78,7 +78,7 @@ module Immutable
|
|
78
78
|
#
|
79
79
|
# @return [Hash]
|
80
80
|
def empty
|
81
|
-
@empty ||=
|
81
|
+
@empty ||= new
|
82
82
|
end
|
83
83
|
|
84
84
|
# "Raw" allocation of a new `Hash`. Used internally to create a new
|
@@ -119,7 +119,7 @@ module Immutable
|
|
119
119
|
def size
|
120
120
|
@trie.size
|
121
121
|
end
|
122
|
-
alias
|
122
|
+
alias length size
|
123
123
|
|
124
124
|
# Return `true` if this `Hash` contains no key/value pairs.
|
125
125
|
#
|
@@ -140,9 +140,9 @@ module Immutable
|
|
140
140
|
def key?(key)
|
141
141
|
@trie.key?(key)
|
142
142
|
end
|
143
|
-
alias
|
144
|
-
alias
|
145
|
-
alias
|
143
|
+
alias has_key? key?
|
144
|
+
alias include? key?
|
145
|
+
alias member? key?
|
146
146
|
|
147
147
|
# Return `true` if this `Hash` has one or more keys which map to the provided value.
|
148
148
|
#
|
@@ -155,7 +155,7 @@ module Immutable
|
|
155
155
|
each { |k,v| return true if value == v }
|
156
156
|
false
|
157
157
|
end
|
158
|
-
alias
|
158
|
+
alias has_value? value?
|
159
159
|
|
160
160
|
# Retrieve the value corresponding to the provided key object. If not found, and
|
161
161
|
# this `Hash` has a default block, the default block is called to provide the
|
@@ -182,7 +182,7 @@ module Immutable
|
|
182
182
|
@default.call(key)
|
183
183
|
end
|
184
184
|
end
|
185
|
-
alias
|
185
|
+
alias [] get
|
186
186
|
|
187
187
|
# Retrieve the value corresponding to the given key object, or use the provided
|
188
188
|
# default value or block, or otherwise raise a `KeyError`.
|
@@ -293,7 +293,7 @@ module Immutable
|
|
293
293
|
# @return [Hash]
|
294
294
|
def update_in(*key_path, &block)
|
295
295
|
if key_path.empty?
|
296
|
-
raise ArgumentError,
|
296
|
+
raise ArgumentError, 'must have at least one key in path'
|
297
297
|
end
|
298
298
|
key = key_path[0]
|
299
299
|
if key_path.size == 1
|
@@ -348,7 +348,7 @@ module Immutable
|
|
348
348
|
@trie.each(&block)
|
349
349
|
self
|
350
350
|
end
|
351
|
-
alias
|
351
|
+
alias each_pair each
|
352
352
|
|
353
353
|
# Call the block once for each key/value pair in this `Hash`, passing the key/value
|
354
354
|
# pair as parameters. Iteration order will be the opposite of {#each}.
|
@@ -423,7 +423,7 @@ module Immutable
|
|
423
423
|
return self if empty?
|
424
424
|
self.class.new(super, &@default)
|
425
425
|
end
|
426
|
-
alias
|
426
|
+
alias collect map
|
427
427
|
|
428
428
|
# Return a new `Hash` with all the key/value pairs for which the block returns true.
|
429
429
|
#
|
@@ -439,8 +439,8 @@ module Immutable
|
|
439
439
|
return enum_for(:select) unless block_given?
|
440
440
|
derive_new_hash(@trie.select(&block))
|
441
441
|
end
|
442
|
-
alias
|
443
|
-
alias
|
442
|
+
alias find_all select
|
443
|
+
alias keep_if select
|
444
444
|
|
445
445
|
# Yield `[key, value]` pairs until one is found for which the block returns true.
|
446
446
|
# Return that `[key, value]` pair. If the block never returns true, return `nil`.
|
@@ -458,7 +458,7 @@ module Immutable
|
|
458
458
|
each { |entry| return entry if yield entry }
|
459
459
|
nil
|
460
460
|
end
|
461
|
-
alias
|
461
|
+
alias detect find
|
462
462
|
|
463
463
|
# Return a new `Hash` containing all the key/value pairs from this `Hash` and
|
464
464
|
# `other`. If no block is provided, the value for entries with colliding keys
|
@@ -485,7 +485,7 @@ module Immutable
|
|
485
485
|
def merge(other)
|
486
486
|
trie = if block_given?
|
487
487
|
other.reduce(@trie) do |trie, (key, value)|
|
488
|
-
if entry = trie.get(key)
|
488
|
+
if (entry = trie.get(key))
|
489
489
|
trie.put(key, yield(key, entry[1], value))
|
490
490
|
else
|
491
491
|
trie.put(key, value)
|
@@ -771,7 +771,7 @@ module Immutable
|
|
771
771
|
# @param other [Object] The object to compare with
|
772
772
|
# @return [Boolean]
|
773
773
|
def ==(other)
|
774
|
-
|
774
|
+
eql?(other) || (other.respond_to?(:to_hash) && to_hash == other.to_hash)
|
775
775
|
end
|
776
776
|
|
777
777
|
# Return true if this `Hash` is a proper superset of `other`, which means
|
@@ -840,7 +840,7 @@ module Immutable
|
|
840
840
|
result << key.inspect << ' => ' << val.inspect
|
841
841
|
i += 1
|
842
842
|
end
|
843
|
-
result <<
|
843
|
+
result << ']'
|
844
844
|
end
|
845
845
|
|
846
846
|
# Return `self`. Since this is an immutable object duplicates are
|
@@ -849,7 +849,7 @@ module Immutable
|
|
849
849
|
def dup
|
850
850
|
self
|
851
851
|
end
|
852
|
-
alias
|
852
|
+
alias clone dup
|
853
853
|
|
854
854
|
# Allows this `Hash` to be printed at the `pry` console, or using `pp` (from the
|
855
855
|
# Ruby standard library), in a way which takes the amount of horizontal space on
|
@@ -858,7 +858,7 @@ module Immutable
|
|
858
858
|
#
|
859
859
|
# @private
|
860
860
|
def pretty_print(pp)
|
861
|
-
pp.group(1, "#{self.class}[",
|
861
|
+
pp.group(1, "#{self.class}[", ']') do
|
862
862
|
pp.breakable ''
|
863
863
|
pp.seplist(self, nil) do |key, val|
|
864
864
|
pp.group do
|
@@ -883,7 +883,7 @@ module Immutable
|
|
883
883
|
end
|
884
884
|
output
|
885
885
|
end
|
886
|
-
alias
|
886
|
+
alias to_h to_hash
|
887
887
|
|
888
888
|
# Return a `Proc` which accepts a key as an argument and returns the value.
|
889
889
|
# The `Proc` behaves like {#get} (when the key is missing, it returns nil or
|
data/lib/immutable/list.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require 'thread'
|
2
|
+
require 'set'
|
3
|
+
require 'concurrent'
|
4
4
|
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
5
|
+
require 'immutable/undefined'
|
6
|
+
require 'immutable/enumerable'
|
7
|
+
require 'immutable/hash'
|
8
|
+
require 'immutable/set'
|
9
9
|
|
10
10
|
module Immutable
|
11
11
|
class << self
|
@@ -175,7 +175,7 @@ module Immutable
|
|
175
175
|
end
|
176
176
|
result
|
177
177
|
end
|
178
|
-
alias
|
178
|
+
alias length size
|
179
179
|
|
180
180
|
# Create a new `List` with `item` added at the front. This is a constant
|
181
181
|
# time operation.
|
@@ -189,7 +189,7 @@ module Immutable
|
|
189
189
|
def add(item)
|
190
190
|
Cons.new(item, self)
|
191
191
|
end
|
192
|
-
alias
|
192
|
+
alias cons add
|
193
193
|
|
194
194
|
# Create a new `List` with `item` added at the end. This is much less efficient
|
195
195
|
# than adding items at the front.
|
@@ -235,7 +235,7 @@ module Immutable
|
|
235
235
|
Cons.new(yield(head), tail.map(&block))
|
236
236
|
end
|
237
237
|
end
|
238
|
-
alias
|
238
|
+
alias collect map
|
239
239
|
|
240
240
|
# Return a `List` which is realized by transforming each item into a `List`,
|
241
241
|
# and flattening the resulting lists.
|
@@ -268,15 +268,15 @@ module Immutable
|
|
268
268
|
return enum_for(:select) unless block_given?
|
269
269
|
LazyList.new do
|
270
270
|
list = self
|
271
|
-
|
271
|
+
loop do
|
272
272
|
break list if list.empty?
|
273
273
|
break Cons.new(list.head, list.tail.select(&block)) if yield(list.head)
|
274
274
|
list = list.tail
|
275
275
|
end
|
276
276
|
end
|
277
277
|
end
|
278
|
-
alias
|
279
|
-
alias
|
278
|
+
alias find_all select
|
279
|
+
alias keep_if select
|
280
280
|
|
281
281
|
# Return a `List` which contains all elements up to, but not including, the
|
282
282
|
# first element for which the block returns `nil` or `false`.
|
@@ -380,8 +380,8 @@ module Immutable
|
|
380
380
|
Cons.new(head, tail.append(other))
|
381
381
|
end
|
382
382
|
end
|
383
|
-
alias
|
384
|
-
alias
|
383
|
+
alias concat append
|
384
|
+
alias + append
|
385
385
|
|
386
386
|
# Return a `List` with the same items, but in reverse order.
|
387
387
|
#
|
@@ -440,7 +440,7 @@ module Immutable
|
|
440
440
|
def transpose
|
441
441
|
return EmptyList if empty?
|
442
442
|
LazyList.new do
|
443
|
-
next EmptyList if any?
|
443
|
+
next EmptyList if any?(&:empty?)
|
444
444
|
heads, tails = EmptyList, EmptyList
|
445
445
|
reverse_each { |list| heads, tails = heads.cons(list.head), tails.cons(list.tail) }
|
446
446
|
Cons.new(heads, tails.transpose)
|
@@ -477,7 +477,7 @@ module Immutable
|
|
477
477
|
# @return [Vector]
|
478
478
|
# @raise [TypeError] if count is not an integer.
|
479
479
|
def rotate(count = 1)
|
480
|
-
raise TypeError,
|
480
|
+
raise TypeError, 'expected Integer' if not count.is_a?(Integer)
|
481
481
|
return self if empty? || (count % size) == 0
|
482
482
|
count = (count >= 0) ? count % size : (size - (~count % size) - 1)
|
483
483
|
drop(count).append(take(count))
|
@@ -640,7 +640,7 @@ module Immutable
|
|
640
640
|
Cons.new(head, tail.union(other, items.add(head)))
|
641
641
|
end
|
642
642
|
end
|
643
|
-
alias
|
643
|
+
alias | union
|
644
644
|
|
645
645
|
# Return a `List` with all elements except the last one.
|
646
646
|
#
|
@@ -742,7 +742,7 @@ module Immutable
|
|
742
742
|
chunk(number).each(&block)
|
743
743
|
self
|
744
744
|
end
|
745
|
-
alias
|
745
|
+
alias each_slice each_chunk
|
746
746
|
|
747
747
|
# Return a new `List` with all nested lists recursively "flattened out",
|
748
748
|
# that is, their elements inserted into the new `List` in the place where
|
@@ -776,7 +776,7 @@ module Immutable
|
|
776
776
|
def group_by(&block)
|
777
777
|
group_by_with(EmptyList, &block)
|
778
778
|
end
|
779
|
-
alias
|
779
|
+
alias group group_by
|
780
780
|
|
781
781
|
# Retrieve the item at `index`. Negative indices count back from the end of
|
782
782
|
# the list (-1 is the last item). If `index` is invalid (either too high or
|
@@ -868,7 +868,7 @@ module Immutable
|
|
868
868
|
list.take(length)
|
869
869
|
end
|
870
870
|
end
|
871
|
-
alias
|
871
|
+
alias [] slice
|
872
872
|
|
873
873
|
# Return a `List` of indices of matching objects.
|
874
874
|
#
|
@@ -895,7 +895,7 @@ module Immutable
|
|
895
895
|
return EmptyList if empty?
|
896
896
|
LazyList.new do
|
897
897
|
node = self
|
898
|
-
|
898
|
+
loop do
|
899
899
|
break Cons.new(i, node.tail.indices(Undefined, i + 1, &block)) if yield(node.head)
|
900
900
|
node = node.tail
|
901
901
|
break EmptyList if node.empty?
|
@@ -1187,7 +1187,7 @@ module Immutable
|
|
1187
1187
|
def dup
|
1188
1188
|
self
|
1189
1189
|
end
|
1190
|
-
alias
|
1190
|
+
alias clone dup
|
1191
1191
|
|
1192
1192
|
# Return `self`.
|
1193
1193
|
# @return [List]
|
@@ -1201,9 +1201,9 @@ module Immutable
|
|
1201
1201
|
#
|
1202
1202
|
# @return [String]
|
1203
1203
|
def inspect
|
1204
|
-
result =
|
1204
|
+
result = 'Immutable::List['
|
1205
1205
|
each_with_index { |obj, i| result << ', ' if i > 0; result << obj.inspect }
|
1206
|
-
result <<
|
1206
|
+
result << ']'
|
1207
1207
|
end
|
1208
1208
|
|
1209
1209
|
# Allows this `List` to be printed at the `pry` console, or using `pp` (from the
|
@@ -1213,7 +1213,7 @@ module Immutable
|
|
1213
1213
|
#
|
1214
1214
|
# @private
|
1215
1215
|
def pretty_print(pp)
|
1216
|
-
pp.group(1,
|
1216
|
+
pp.group(1, 'Immutable::List[', ']') do
|
1217
1217
|
pp.breakable ''
|
1218
1218
|
pp.seplist(self) { |obj| obj.pretty_print(pp) }
|
1219
1219
|
end
|
@@ -1290,7 +1290,7 @@ module Immutable
|
|
1290
1290
|
def size
|
1291
1291
|
@size ||= super
|
1292
1292
|
end
|
1293
|
-
alias
|
1293
|
+
alias length size
|
1294
1294
|
|
1295
1295
|
def cached_size?
|
1296
1296
|
@size != nil
|
@@ -1319,7 +1319,7 @@ module Immutable
|
|
1319
1319
|
realize if @atomic.value != 2
|
1320
1320
|
@head
|
1321
1321
|
end
|
1322
|
-
alias
|
1322
|
+
alias first head
|
1323
1323
|
|
1324
1324
|
def tail
|
1325
1325
|
realize if @atomic.value != 2
|
@@ -1334,7 +1334,7 @@ module Immutable
|
|
1334
1334
|
def size
|
1335
1335
|
@size ||= super
|
1336
1336
|
end
|
1337
|
-
alias
|
1337
|
+
alias length size
|
1338
1338
|
|
1339
1339
|
def cached_size?
|
1340
1340
|
@size != nil
|
@@ -1346,7 +1346,7 @@ module Immutable
|
|
1346
1346
|
MUTEX = Mutex.new
|
1347
1347
|
|
1348
1348
|
def realize
|
1349
|
-
|
1349
|
+
loop do
|
1350
1350
|
# try to "claim" the right to run the block which realizes target
|
1351
1351
|
if @atomic.compare_and_set(0,1) # full memory barrier here
|
1352
1352
|
begin
|
@@ -1392,7 +1392,7 @@ module Immutable
|
|
1392
1392
|
realize if @head == Undefined
|
1393
1393
|
@head
|
1394
1394
|
end
|
1395
|
-
alias
|
1395
|
+
alias first head
|
1396
1396
|
|
1397
1397
|
def tail
|
1398
1398
|
realize if @tail == Undefined
|
@@ -1407,7 +1407,7 @@ module Immutable
|
|
1407
1407
|
def size
|
1408
1408
|
@size ||= super
|
1409
1409
|
end
|
1410
|
-
alias
|
1410
|
+
alias length size
|
1411
1411
|
|
1412
1412
|
def cached_size?
|
1413
1413
|
@size != nil
|
@@ -1455,7 +1455,7 @@ module Immutable
|
|
1455
1455
|
mutex = @mutex
|
1456
1456
|
mutex && mutex.synchronize do
|
1457
1457
|
return if @head != Undefined # another thread got ahead of us
|
1458
|
-
|
1458
|
+
loop do
|
1459
1459
|
if !@buffer.empty?
|
1460
1460
|
@head = @buffer.shift
|
1461
1461
|
@tail = Partitioned.new(@partitioner, @buffer, @mutex)
|
@@ -1516,7 +1516,7 @@ module Immutable
|
|
1516
1516
|
mutex = @mutex
|
1517
1517
|
mutex && mutex.synchronize do
|
1518
1518
|
return if @head != Undefined # another thread got ahead of us
|
1519
|
-
|
1519
|
+
loop do
|
1520
1520
|
if !@buffer.empty?
|
1521
1521
|
@head = @buffer.shift
|
1522
1522
|
@tail = Left.new(@splitter, @buffer, @mutex)
|
@@ -1568,7 +1568,7 @@ module Immutable
|
|
1568
1568
|
def head
|
1569
1569
|
nil
|
1570
1570
|
end
|
1571
|
-
alias
|
1571
|
+
alias first head
|
1572
1572
|
|
1573
1573
|
# There are no subsequent elements, so return an empty list.
|
1574
1574
|
# @return [self]
|
@@ -1585,7 +1585,7 @@ module Immutable
|
|
1585
1585
|
def size
|
1586
1586
|
0
|
1587
1587
|
end
|
1588
|
-
alias
|
1588
|
+
alias length size
|
1589
1589
|
|
1590
1590
|
def cached_size?
|
1591
1591
|
true
|
data/lib/immutable/nested.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
1
|
+
require 'set'
|
2
|
+
require 'sorted_set'
|
3
|
+
require 'immutable/hash'
|
4
|
+
require 'immutable/set'
|
5
|
+
require 'immutable/vector'
|
6
|
+
require 'immutable/sorted_set'
|
7
|
+
require 'immutable/list'
|
8
|
+
require 'immutable/deque'
|
9
9
|
|
10
10
|
module Immutable
|
11
11
|
class << self
|