I am trying to write this function to a lambda function, I tried many options and I could not succeed:
def getitem_rlist(s, i): while i > 0: s, i = rest(s), i - 1 return first(s)
I know for starters:
getitem_rlist=lambda s,i:....?
thanks! as an example, if: s=(1,(2,(3,4))) , then getitem_rlist(a,2))# -> 3 function should return the element to the index i of the recursive list s
source share