So, I'm trying to do some set fixed point recursion stuff in Scala, but I'm not exactly sure how I should set things up properly. Mutable sets? Specifically, I'm trying to find all the possible states a pushdown automaton can go to, from some state/stack pair using only epsilon transitions. Basically, I'm after the transitive closure of the transition relation starting at a specific configuration.

To use language slightly less obscure: I have a set, and an element of that set. I also have a function from an element of the set to a subset. I want the subset that is exactly those elements for which the result of the function lands inside this subset. Does !lambda contain any Scala hackers? Perhaps !fscons ?