fun every<T>(list: Array<T>, condition: (T) -> Boolean): Boolean = do {
  fun private_every<T>(list: Array<T>, condition: (T) -> Boolean): Boolean = do {
    true
  }
  ---
  list match {
    case [] -> false
    else -> private_every(list, condition)
  }
}



fun tailRec<T>(list: Array<T>, condition: (T) -> Boolean): Boolean = do {
  fun private_every<T>(list: Array<T>, condition: (T) -> Boolean): Boolean = do {
    list match {
      case [] -> true
      case [head ~ tail] ->
        if(condition(head))
          private_every(tail, condition)
        else
          false
    }
  }
  ---
  list match {
    case [] -> false
    else -> private_every(list, condition)
  }
}
