【发布时间】:2014-09-03 20:58:49
【问题描述】:
enum Tree{
case Leaf(String)
case Node(Tree)
} //compiler not happy!!
enum Tree{
case Leaf(String)
case Node([Tree])
} //compiler is happy in (arguably) a more complex recursive scenario?
Swift 编译器如何在第二个(更复杂的)场景而不是第一个场景下工作?
【问题讨论】:
-
因为有一个中间步骤
Array,可以避免直接递归。
标签: swift