In your second case odd(a::nil) = a you return a, which is a single element. In the other two cases you return a list. If you change it to odd(a::nil) = [a], so all cases return a list, it works.
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkRead more