Viewing a part of an array as a dictionary

I have an array array (actually a Vector, to keep it simple), and I want to do work (let’s say call a function do_work) on only those values indexed by some set S of indices of that vector. This subset has no reason to be an interval. The function do_work should, if possible, be written as accepting, as input, any given collection. On the other hand, the nature of the work requires that the indexing set remains S (as an example, think “splitting a graph in connected components”); this means that simply passing array[S] is not an option since this would reindex to 1:length(S).

Does there exist a way to build a “dictionary view” of an array (i.e. something inheriting from AbstractDict)? A fixed set of indices is not a problem in my case. I just looked at Dictionaries.jl, and I don’t believe that that package includes such a type.

(Really, all the data I need to pass to my do_work function is the triple (S, k->getindex(array,k), (k,v)->setindex!(array,v,k)), but it would be nice to have a struct encapsulating these and the corresponding index-set guards).

Edit I think I found something in Dictionaries.jl, I leave the post up in case this is proves useful to someone:

array=ArrayDictionary([:a,:b,:c,:d])
subarray = view(array, Indices([2,1,4]))
subarray[2] = :replaced