Solution 1: The base case should describe all lists of length one, the shortest possible non-empty lists:
; A non-empty list of numbers (nelo-numbers) is one of
; - (cons f empty)
; where f is a number
; - (cons f r)
; where f is a number, r is a nelo-numbers
Solution 2: Use the definition of lists-of-numbers that we already know.
; A non-empty list of numbers (nelo-numbers) is
; (cons f r)
; where f is a number, r is a list-of-numbers
When you develop programs, you should use the template corresponding to the definition you choose.
(define (f a-nelon)
(cond
[(empty? (rest a-nelon)) ...(first a-nelon)...]
[else ...(first a-nelon)...(f (rest a-nelon))...]))
(define (f a-nelon)
...(first a-nelon)...(rest a-nelon)...)
where f probably calls another function on
(rest a-nelon) that consumes a list of numbers, not
just a non-empty list of numbers.