Advertisement
Guest User

Untitled

a guest
Feb 13th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. def pitDepth(p: Int, q: Int, r: Int) = (p - q) min (r - q)
  2.  
  3. def updateDepths(pqrd: (Int,Int,Int,Int), x: Int): (Int,Int,Int,Int) = pqrd match {
  4. case (p,q,r,d) if /*conds*/ => /*upslope reset*/
  5. case (p,q,r,d) if /*conds*/ => /*update q*/
  6. case (p,q,r,d) if /*conds*/ => /*update r and d*/
  7. case (p,q,r,d) if /*conds*/ => /*update d and reset*/
  8. }
  9.  
  10. def maxDepth(list: List[Int]): Int = list match {
  11. case Nil => -1
  12. case head :: tail => tail.foldLeft((head,Int.MaxValue,Int.MinValue,-1)) ((quad,x)=>updateDepths(quad,x))._4
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement