Reputation: 348
What should 'foo' be called, given the following?
x.items is a set, y.values is a set.
function a(key) returns an ordered list of x.items
function b(x.item) returns a single y.value
Define foo(a, b), which returns a function, d, such that d(key) returns a list of y.values defined by: map(b, a(key)).
This feels like a fairly common and generic function composition but I don't know what to call it.
Upvotes: 1
Views: 290
Reputation: 2947
I would call that function permuted_values
What you are doing is equivalent to iterating over a hash map using a permutation based on your key.
Upvotes: 1
Reputation: 47075
function a(key) returns an ordered list of x.items
function b(x.item) returns a single y.value
Except for the ordering, a() is in practice a filter, i.e. it "filters" or "selects" items from x.items according to a key. b() is a normal map, or function. Thus, I would choose for 'foo' the name "composeFilterWithMap", or "composeSelectorWithMap" or a similar name.
Upvotes: 2
Reputation: 348
Here's are example names for a, b, and foo that might help (I don't like these, but they're sort of like what I'm getting at):
items_by_key(key) value_by_item(item) values_by_key(items_by_key, value_by_item)
Upvotes: 0