Skip to content

Instantly share code, notes, and snippets.

View pietro909's full-sized avatar

pietro909 pietro909

View GitHub Profile
@pietro909
pietro909 / kata.scala
Last active January 3, 2017 19:55 — forked from anonymous/kata.scala
Functional Programming in Scala - Chapter 2
import com.scalakata._
@instrument class Playground {
// help
def isSorted[A](as: Array[A], ordered: (A, A) => Boolean): Boolean = {
def go(n: Int): Boolean =
if (n >= as.length-1) true
else if (!ordered(as(n), as(n+1))) false
else go(n+1)