sweeneyde

composition

Jan 26th, 2020
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.28 KB | None | 0 0
  1. class F:
  2.  def __init__(f, _f):f._f=_f
  3.  __call__=lambda f,x:f._f(x)
  4.  __matmul__=lambda f,g:F(lambda x:f(g(x)))
  5.  __rmatmul__=lambda f,g:F(g)@f
  6. fm=lambda f:F(lambda x:map(f,x))
  7. p=lambda x:(x.lower(),x)
  8. @F
  9. def u(x):return x[1]
  10.  
  11. (list @ fm(print@u) @ sorted @ fm(p))("FuNcTiOnAl")
Add Comment
Please, Sign In to add comment