Make function more julian / simpler

What you are describing is a multiset difference, and the easiest (and perhaps most efficient) way would probably be to use the Multisets.jl package:

julia> using Multisets

julia> m = Multiset(array1) - Multiset(array2)
{1,1,2,3,3,5}

Although you can convert the result back to an array with collect(m), if this is the kind of operation you want then you might consider not using arrays at all — just leave everything as a Multiset.

10 Likes