Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Scala isPalindrome
def isPalindrome[A](x: Vector[A]): Boolean = x match {
case start +: middle :+ end => start == end && isPalindrome(middle)
case _ => true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment