Skip to content

Instantly share code, notes, and snippets.

@ManDeJan
Created March 7, 2019 22:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ManDeJan/1b05c202bfe0ea039ba6e126238c1da0 to your computer and use it in GitHub Desktop.
Save ManDeJan/1b05c202bfe0ea039ba6e126238c1da0 to your computer and use it in GitHub Desktop.
CAR & CDR in 1 line of Python
for _ in map(exec, map(lambda s: f'''{"""""".join(map(chr, range(100, 103)))} c{s}r(l): h,*t=l; return {"c" + s[:-1] + "r(" + ("h)" if s[-1] == "a" else "t)") if s[:-1] else "h" if s[-1] == "a" else "t"}''', [f'{bin(i)[2:].zfill(x)}'.translate({48: 97, 49: 100}) for x in range(10) for i in range(2**10)])): pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment