Commit Graph

78 Commits

Author SHA1 Message Date
Franz Höltermann 873b7f8588 Fixed type of temporary slice in sort_by_indices_overwrite 2024-01-08 17:11:06 +01:00
gingerBill 173527d631 Remove random tag 2023-12-13 01:53:15 +00:00
gingerBill f8cb2bcad2 Add slice.unique and slice.unique_proc 2023-12-13 01:50:26 +00:00
gingerBill b011487778 Reimplement binary_search_by to be simpler 2023-12-13 01:37:15 +00:00
gingerBill c8cc130744 Fix the implementation of binary_search_by to work with a normal ordering call, rather than the backwards version.
WHY THE HECK WAS IT THIS WAY IN THE FIRST PLACE?!
2023-12-13 01:24:03 +00:00
gingerBill fe0244606b Revert 2023-12-13 01:20:53 +00:00
gingerBill 036fa6482c Use cmp_proc in binary_search 2023-12-13 01:18:05 +00:00
gingerBill 04ca22b9ea Add to core:slice reduce_reverse, filter_reverse, repeat 2023-12-13 00:35:23 +00:00
Matija Dizdar 843b2350eb added #no_bounds_check back into binary_search_by 2023-12-06 21:48:37 +01:00
Matija Dizdar 526d338300 removed incorrect requirement for key type to be ordered in binary_search_by 2023-12-06 21:29:18 +01:00
Tarık B 5a661dc67b Add min_index and max_index procedures 2023-11-26 08:33:50 +01:00
Hector 9f96382558 Removed some accidental semi-colons and converted indentation to tabs. 2023-11-25 16:36:51 +00:00
Hector 1db5e1250f Binary search improvements
Modified the algorithm so that the index is either the location of the
element if found or the index at which to insert the element to maintain
sorted order.

Also added some tests to verify the above claim.
2023-11-25 13:48:48 +00:00
flysand7 270348b112 [core]: Remove do keyword from the core library 2023-11-11 20:36:38 +11:00
Karl Zylinski d2ac3c2228 Make slice.clone and slice.clone_to_dynamic take a loc parameter 2023-10-30 21:19:21 +01:00
gingerBill d50a844720 Replace mem with runtime in core:slice 2023-06-28 11:04:51 +01:00
gingerBill 9371325246 Fix typo 2023-05-25 12:19:41 +01:00
gingerBill 600c97cc0f Add missing Allocator_Error and @(require_results) to many procedures 2023-05-22 11:34:38 +01:00
gingerBill 5bbdbadc25 Remove where ORD(E) on procedures that don't need it 2023-03-14 14:05:23 +00:00
gingerBill db8b2e69dd Fix slice.reverse 2023-01-27 11:12:10 +00:00
Andrea Piseri 3fa971a510 Add the inner for loop back in the logic
This could be easier to predict in cases where one of `left` and `right`
is significantly greater than the other, and as such the same branch is
taken multiple times in a row
2022-12-21 22:10:02 +01:00
Andrea Piseri 191223bb3c Fix non-generic cast in core:slice.rotate_left 2022-12-21 21:58:01 +01:00
Andrea Piseri 385d2a143c Fix core:slice.rotate_left
This commit includes two fixes:
- a temporary cast to make the function compile
- a fix to a logic error that caused the function to hang or return
  incorrect results
2022-12-21 21:09:22 +01:00
André (counter) 7fbee88061 Fix typo err: runtime.Allocator to Allocator_Error 2022-12-09 19:20:03 +01:00
gingerBill 6dd4d1a924 Correct reflection usage of maps 2022-11-08 11:50:55 +00:00
gingerBill 075040ae05 Update sort_private.odin 2022-10-18 00:06:21 +01:00
gingerBill c4d19dfa92 Use uint instead of int to improve code generation for bounds checking 2022-09-27 22:31:46 +01:00
gingerBill c056a0d108 Add slice.enumerated_array 2022-09-22 00:52:37 +01:00
gingerBill 756c1b7bcb Correct slice/ptr.odin calls 2022-09-17 15:12:32 +01:00
Phil 7d55bfc120 fix sort_by_indices_allocate 2022-09-07 10:53:56 -07:00
Phil 3f3ae4b2b6 fix sort_by_with_indices for zero and one length slices: 2022-09-01 13:14:10 -07:00
Phil 63eec25044 add sort_by_indices overload and test 2022-09-01 12:32:33 -07:00
Phil 7a9b0731cf add tests for sort_by_indices 2022-09-01 12:13:15 -07:00
Phil d45661c405 cleanup slice sorting with indices changes 2022-09-01 11:51:45 -07:00
Phil 002bec256a have sort_with_indices allocate. Add a couple convenience procs for using the indices result to sort other slices. 2022-09-01 11:46:59 -07:00
Phil 15aaf7dfa0 add sort_with_indices family of procs 2022-08-31 14:06:21 -07:00
gingerBill 2908923db9 Fix #1972 2022-08-24 12:18:42 +01:00
Jeroen van Rijn 9f413862e9 Add strings.prefix_length & slice.prefix_length 2022-06-16 12:34:13 +02:00
gingerBill ff9d058392 Minor changes to core:slice/heap; add to examples/all 2022-06-12 17:25:42 +01:00
gingerBill 1acc8f438b Merge pull request #1830 from graphitemaster/dale/max_heap
add max heap implementation to slice package
2022-06-12 17:21:04 +01:00
Despacito696969 a343fb171d Fixed slice.is_sorted_cmp 2022-06-07 14:07:19 +02:00
Dale Weiler a996cfc536 fix 2022-06-04 04:47:52 -04:00
Dale Weiler c1d55b9296 add max heap implementation to slice package 2022-06-04 04:31:55 -04:00
gingerBill fb49841b1d Remove strings dependency from core:sys/windows 2022-06-02 13:02:16 +01:00
Tetralux 7428e52264 Duplicate some basic slice procedures from core:mem into core:slice 2022-04-18 16:56:45 +00:00
Andrea Piseri a040be957f Fix tail recursion in _quick_sort_general
The `if` statement should have been a `for` loop, in order to allow recursively
sorting the subarrays with quicksort, and not resort to shell sort after
one step.
2022-04-13 10:55:16 +02:00
gingerBill 29e660b16f Add more things to package slice
min_max
any_of(_proc)
none_of(_proc)
all_of(_proc)
count(_proc)
2022-03-08 10:02:40 +00:00
gingerBill 2f1aeaf757 Remove the unneeded $ 2022-01-31 15:56:40 +00:00
gingerBill 14a17fb36f Add slice.stable_sort* procedures 2022-01-31 15:55:52 +00:00
gingerBill 1a9ec776cb Unify logic for slice.sort* related procedures 2022-01-31 12:43:20 +00:00