Remove elements with matching string values in tuple

I have a list called list1:

[a,b,c]

And use the function

function combos(list1,list2)
    combolist=vec(collect(Base.product(list1,list2)))
    return combolist
end

And my results look something like below:

(a,a)
(a,b)
(b,b)
(b,c)
(c,c)

Is there a way to remove (a,a), (b,b), (c,c)?

Do you know the Combinatorics package?

julia> using Combinatorics
julia> a = ["a","b","c"]
julia> Tuple.(collect(combinations(a,2)))
3-element Array{Tuple{String,String},1}:
 ("a", "b")
 ("a", "c")
 ("b", "c")

But as your example isn’t complete, this is perhaps not what you want.

2 Likes