 extension Deque : CustomDebugStringConvertible {
   public var debugDescription: String {
     
-    return "[\(fCount), \(bCount)]: " +
+    return
       ", ".join(front.map { String(reflecting: $0) }) + " | " +
       ", ".join(back.reverse().map { String(reflecting: $0) })
   }

public struct Deque<Element> {
  private var front: List<Element> { didSet { check() } }
  private var back : List<Element> { didSet { check() } }
  private var fCount, bCount: Int
  
  public init() {
    (front, back)    = (.Nil, .Nil)
    (fCount, bCount) = (0, 0)
  }
}

extension Deque {
  private init(front: List<Element>, back: List<Element>, fCount: Int, bCount: Int) {
    (self.front, self.back)    = (front, back)
    (self.fCount, self.bCount) = (fCount, bCount)
  }
  private init(front: [Element], noReverseBack: [Element]) {
    (self.front, back) = (List(seq: front), List(seq: noReverseBack))
    (fCount, bCount)   = (front.count, noReverseBack.count)
    check()
  }
}

extension Deque {
  private mutating func check() {
    if fCount == 1 || bCount == 1 { return }
    switch (front, back) {
    case (.Nil, let .Cons(head, tail)):
      (front, back)    = (tail.reverse(), [head])
      (fCount, bCount) = (bCount - 1, 1)
    case (let .Cons(head, tail), .Nil):
      (back, front)    = (tail.reverse(), [head])
      (bCount, fCount) = (fCount - 1, 1)
    default:
      return
    }


extension Deque {
  public mutating func prepend(with: Element) {
    front = with |> front
  }
  public mutating func append(with: Element) {
    back = with |> front
  }
}
