I have a (in theory) simple method in Scheme, that has to use recursion. The problem is that I can't seem to figure out the recursion part... I have a procedure that takes a 'pointer' and arbitrary many arguments, and I need to pass the arguments one by one to another method. Here is what I got so far:
(define (push-elements ptr . args)
(define (push-all ptr list)
(if (null? list)
'()
(ptr 'push-elements (car list))))
(push-all ptr list))
I know there is no recursion here, but I can't understand where to put it/how to do it. The thought is clear, inside 'push-all' I need to call:
(push-all ptr (cdr list))
If anyone could help me (and I would be very grateful for an explanation on how to go about making such a recursive method), that would be great.