Sept. 27, 2007
12:18 p.m.
George Sakkis wrote:
Or in a more obfuscated way:
import operator as op from itertools import imap
from functools import partial
if any(imap(partial(op.is_,x), (a, b, c))): ...
if all(imap(partial(op.is_not,x), (a, b, c))): ...
George
Or in haskell (assuming haskell would have "is" and "is not"): if any (x is) [a, b, c] then ... else ... if all (x is not) [a, b c] then ... else ... I'm not sure if "any" and "all" are the ones with 2 parameters (function and list) or if that would be "or" and "and". -panzi