I'm having a small issue working with DrRacket. I've programmed pretty extensively in C, C++, Java, Python, etc, but never worked with a functional programming language before so I'm getting tripped up.
I have a node, and I need to return a list of the "eye-color" feature of that node, and all of it's parent elements (and parents' parents etc). Here's what I have, and I can't figure out where I'm going wrong. I suspect it's something to do with all the "empty"s that I'm having to add, because I don't really get those. So many damn parenthesis too, haha. It's getting everything right, but there's a bunch of other space or something instead of one list.
(define (eye-colors f)
(cond [(empty? f) empty]
[ else (cons (cons (child-eyes f) (eye-colors (child-mom f))) (eye-colors (child-mom f)))]))
My output for one particular node is this:
(list
(list
'blue
(list 'green (list 'brown))
(list 'blue))
(list 'orange))
when it should be this:
(list 'blue 'green 'brown 'blue 'orange)
Any help that you can offer is much appreciated!!