1
1
mirror of https://github.com/github/semantic.git synced 2024-12-27 00:44:57 +03:00
semantic/prototype/Doubt/Tree.swift
2015-09-15 13:55:46 -04:00

14 lines
299 B
Swift

public enum Tree<A>: CustomStringConvertible {
case Leaf(A)
case Branch([Tree])
public var description: String {
switch self {
case let .Leaf(value):
return String(value)
case let .Branch(children):
return "(" + children.lazy.map { String($0) }.joinWithSeparator(" ") + ")"
}
}
}