I first need to mention that I'm quite new to Scheme and as such, the following question might not make too much sense.
At school, we've defined algebraic data types, that typically had a nullary constructor and some internal/external ones as well.
In this particular case, I'm interested in making a BTree binary tree type (perhaps balanced, in a future iteration) and I'd like something like this which is how Haskell treats constructors. I've previously seen how to implement trees in Scheme, here for instance, but this is not what I want.
I don't want is to just make a wrapper around lists. I simply want to write something like:
nil: -> BTree
node: BTree x T x BTree -> BTree
and then have it know what I mean by:
flattenTree: BTree -> List
and then, I would define it to be (assuming left, right, key are defined):
(define flattenTree
(lambda (t)
(node (flattenTree (left t))
(key t)
(flattenTree (right t)))))
Also, I welcome suggestions for properly indenting my Scheme code... (and be kindly modded up)