(define (reverse xs) (let recur ((ys '()) (xs xs)) (if (null? xs) ys (recur (cons (car xs) ys) (cdr xs)))))
Notice that the named let mimics foldl - "constant space" tail-recursion with an accumulator.
(define (reverse xs) (foldl (flip cons) '() xs))
(define reverse (partially foldl (flip cons) '()))
append-like accumulating helper, always called with
local fun revAppend (, ys) = ys | revAppend (x::xs, ys) = revAppend (xs, x::ys) in fun rev xs = revAppend(xs,); end;
reverse l = rev l  where rev  a = a rev (x:xs) a = rev xs (x:a)
reverse = foldl' (flip (:)) 
reverse(X) -> reverse(X, ). reverse([H|T], Y) -> reverse(T, [H|Y]); reverse(, X) -> X.
(define reverse X -> (reverse_help X )) (define reverse_help  R -> R [X | Y] R -> (reverse_help Y [X | R]))