Created
September 3, 2009 13:16
-
-
Save NicolasT/180287 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p = lambda fun: lambda arg: (lambda m: fun(arg(m))) if callable(arg) \ | |
else fun(arg) | |
agent = p(lambda m: m.agent) | |
parent = p(lambda m: m.parent) | |
class D: pass | |
m1 = D() | |
m1.agent = 'agentm1' | |
m2 = D() | |
m2.agent = 'agentm2' | |
m2.parent = m1 | |
m3 = D() | |
m3.parent = m2 | |
selector = agent(parent(parent)) | |
print selector(m3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment