Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed slice.unique and slice.unique_proc #3277

Merged
merged 1 commit into from
Mar 14, 2024

Conversation

kavalee
Copy link

@kavalee kavalee commented Mar 14, 2024

Fixed issue #3276 regarding slice.unique and slice.unique_proc returning incorrect slices.

Below is a small test of slice.unique and slice.unique_proc that failed, and are now fixed with this patch.

package demo 

import "core:fmt"
import "core:slice"
main :: proc() {
	s := []int{2,2,2}
	res := slice.unique(s)
	assert(slice.equal(res,[]int{2}))

	res = slice.unique([]int{1,1,1,2,2,3,3,3,3})
	assert(slice.equal(res, []int{1,2,3}))

	equal := proc(a,b: int) -> bool{
		return a == b
	}
	res = slice.unique_proc([]int{1,1,1,2,2,3,3,3,3}, equal)
	assert(slice.equal(res, []int{1,2,3}))
}

@gingerBill gingerBill merged commit 51d6a25 into odin-lang:master Mar 14, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants