I think I have almost done solution with previous problem: Foldr in scheme but in code is a small trouble. I need #t but I get first element, false is OK. Here is my code:
(define accum
(lambda (list1 pre?)
(foldr (lambda (x y)
(if y
(if (or (equal? y #t) (pre? x y))
x
#f)
#f))
#t
list1)))
(accum '(1 2 3 4) <=) --> 1 (should be #t)
(accum '(2 2 4 4) <=) --> 2 (should be #t)
(accum '(1 2 5 4) <=) --> #f
(accum '(5 7 2 3) <=) --> #f
If I write "x --> #t", I always get #t, even if is #f.