dakaizou

append cps

Sep 22nd, 2022 (edited)
1,306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | None | 0 0
  1. def identity(x):
  2.     return x
  3.  
  4. def append(l1, l2):
  5.     def append_cps(l1, l2, k):
  6.         if not l1:
  7.             return k(l2)
  8.  
  9.         def arrange(appended):
  10.             return k([l1[0]] + appended)
  11.  
  12.         return append_cps(l1[1:], l2, arrange)
  13.  
  14.     return append_cps(l1, l2, identity)
Advertisement
Add Comment
Please, Sign In to add comment