   }
 }
 
-struct X : Collection {
+struct X : BidirectionalCollection {
   typealias Element = String.CharacterView.Iterator.Element
   typealias Index = String.Index
   var msg: String

  }
  subscript(i: Index) -> Element { return msg[i] }
  func next(i: Index) -> Index { return msg.next(i) }
}

var foobar = X("foobar")

print(isPalindrome2(X("Zerimar-O-ramireZ")))

func isPalindrome4<
  S: BidirectionalCollection
  where
  S.Iterator.Element : Equatable,
  S.Indices.Iterator.Element == S.Index
>(seq: S) -> Bool {
  typealias Index = S.Index

  let a = PermutationGenerator(elements: seq, indices: seq.indices)
  // FIXME: separate ri from the expression below pending
  // <rdar://problem/15772601> Type checking failure
  let i = seq.indices
  let ri = i.lazy.reversed()
  var b = PermutationGenerator(elements: seq, indices: ri)
  for nextChar in a {
