Let me get this straight, you need the length of the Collatz sequence for each of the numbers in the items
list? Clearly this is homework, so I can't give a straight answer this time. Here's the general structure of the solution, fill-in the blanks:
(define (find-length items)
(if (null? items) ; if the list is null
<???> ; return the empty list
(cons ; otherwise `cons` the
(length <???>) ; length of Collatz sequence of first element
(find-length <???>)))) ; and recur over the rest of the list
Test the procedure, the result should be as shown below:
(find-length '(10 13 16 22 95 158))
=> '(7 10 5 16 106 37)
Notice that your answer was almost right - the base case for this procedure is simply the empty list, and you forgot to call the recursion. In Scheme, at least for know, try not to think about while, for loops: implement iteration in terms of recursion, that's the idiomatic way to do it. After you get that straight, you can start using one of the built-in looping constructs available in Racket.