Oh, thanks. I should have mentioned comprehensions. It’s really just a case of thinking that filter might convey the intent more clearly than a comprehension, and then finding that the syntax didn’t work as cleanly.
In fact, I’m trying to filter a Dict with a Set of keys. It would be really nice if an intersection worked:
d = Dict("a" => 1, "b" => 2, "c" => 3)
s = Set(["a", "c"])
d ∩ s # doesn't work - fair enough because it's trying to match the pairs in `d`
While that would indeed indeed nice notation for it, you can do that as well with a comprehension
# if all of the elements of s are definitely keys of d
Dict(k => d[k] for k in s)
# if not
Dict(k => d[k] for k in s if haskey(d, k))
# also possible with filter, but it's slower in general because it requires more inclusion checks.
filter(e -> first(e) ∈ s, d)