The main problem is that when setting the list, return all the elements of this list that are different from the last element. For example, given (abcd) -> return (abc). I have a function, it's just the syntax of the circuit I'm having problems with, and Google is not very friendly. I'm not sure if I use the cons correctly.
(define all-but-last (lambda (x) (if (null? (cdr x)) ('())) (cons ((car x) (all-but-last(cdr x))) )))
Someone who is well versed in r5rs syntax will be helpful. Thanks!
source share