Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Last active June 25, 2021 06:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save velotiotech/a81b3d829a82d2dcf43ed6e70b7e8c8b to your computer and use it in GitHub Desktop.
Save velotiotech/a81b3d829a82d2dcf43ed6e70b7e8c8b to your computer and use it in GitHub Desktop.
def g1(s={}):
f1 = lambda a: a.strip().split()
f2 = lambda a: map(lambda x: s[x] if x in s else s.setdefault(x, len(s) + 1), a)
f3 = lambda a: "->".join(map(lambda b: str(b), a))
return f1, f2, f3
def g2(x, fs):
for f in fs:
x = f(x)
return x
fs = g1()
print(g2("Hello World", fs))
print(g2("Hello Sam", fs))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment