Given list, subset of list: return bitmask (bit vector same length as list) corresponding to the subset.
For example,

    bitmask({1, 2, 3, 4}, {2, 4})

returns

    {False, True, False, True}

The naive way to do this is to map a membership function over the list:

    map(lambda(x, member(x, subset)), list)

but that's O(n*m) and it can be done in O(n+m).

What's the best way to implement bitmask() in your favorite language?

Given list, subset of list: return bitmask (bit vector same length as list) corresponding to the subset.
===

For example,

    bitmask({1, 2, 3, 4}, {2, 4})

returns

    {False, True, False, True}

The naive way to do this is to map a membership function over the list:

    map(lambda(x, member(x, subset)), list)

but that's O(n*m) and it can be done in O(n+m).

What's the best way to implement bitmask() in your favorite language?
