4 ms·
Do we know if enums can be recursive? i.e. enum BinaryTree = { case Leaf(Int) case Node(BinaryTree, BinaryTree) }
by alex2014 12y ago
Do we know if enums can be recursive?
i.e.
enum BinaryTree = {
case Leaf(Int)
case Node(BinaryTree, BinaryTree)
}
- axman6 12y agoI saw somewhere else today that someone tried it and it crashed the compiler, so I guess not. The string "recur" doesn't even occure once in the iBook. It seem though that you might be able to use a combination of objects and enums to get that.