; reluctant search
(define (research x xs i j)
(if (> i j)
-1
(if (= i j)
(if (= x (vector-ref xs i))
i
-1)
(let ((m (quotient (+ i j) 2)))
(if (<= x (vector-ref xs m))
(let ((k (research x xs (+ m 1) j)))
(if (= k -1)
(research x xs i m)
k)))
(let ((k (research x xs i m)))
(if (= k -1)
(research x xs (+ m 1) j)
k))))))
(display (research 3 '#(1 2 3 5 6) 0 4)) (newline)
(display (research 4 '#(1 2 3 5 6) 0 4)) (newline); your code goes here
OyByZWx1Y3RhbnQgc2VhcmNoCgooZGVmaW5lIChyZXNlYXJjaCB4IHhzIGkgaikKICAgIChpZiAoPiBpIGopCiAgICAgICAgLTEKICAgICAgICAoaWYgKD0gaSBqKQogICAgICAgICAgICAoaWYgKD0geCAodmVjdG9yLXJlZiB4cyBpKSkKICAgICAgICAgICAgICAgIGkKICAgICAgICAgICAgICAgIC0xKQogICAgICAgICAgICAobGV0ICgobSAocXVvdGllbnQgKCsgaSBqKSAyKSkpCiAgICAgICAgICAgICAgICAoaWYgKDw9IHggKHZlY3Rvci1yZWYgeHMgbSkpCiAgICAgICAgICAgICAgICAgICAgKGxldCAoKGsgKHJlc2VhcmNoIHggeHMgKCsgbSAxKSBqKSkpCiAgICAgICAgICAgICAgICAgICAgICAgIChpZiAoPSBrIC0xKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgKHJlc2VhcmNoIHggeHMgaSBtKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaykpKQogICAgICAgICAgICAgICAgICAgIChsZXQgKChrIChyZXNlYXJjaCB4IHhzIGkgbSkpKQogICAgICAgICAgICAgICAgICAgICAgICAoaWYgKD0gayAtMSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIChyZXNlYXJjaCB4IHhzICgrIG0gMSkgaikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGspKSkpKSkKCihkaXNwbGF5IChyZXNlYXJjaCAzICcjKDEgMiAzIDUgNikgMCA0KSkgKG5ld2xpbmUpCihkaXNwbGF5IChyZXNlYXJjaCA0ICcjKDEgMiAzIDUgNikgMCA0KSkgKG5ld2xpbmUpOyB5b3VyIGNvZGUgZ29lcyBoZXJl