Merge pull request #142 from adrianVmariano/master

unique_count bugfix
This commit is contained in:
Revar Desmera 2020-03-18 20:11:10 -07:00 committed by GitHub
commit cb11ac558a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -798,6 +798,7 @@ function unique(arr) =
// arr = The list to analyze.
function unique_count(arr) =
assert(is_list(arr) || is_string(arr))
arr == [] ? [[],[]] :
let( arr=sort(arr) )
let(ind = [0,for(i=[1:1:len(arr)-1]) if (arr[i]!=arr[i-1]) i])
[select(arr,ind),