Guest User

Untitled

a guest
May 13th, 2012
172
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   def lookupL[K, V](k: K): List[(K, V)] @?> V = {
  2.     @annotation.tailrec
  3.     def lookupr(z: (List[(K, V)], (K, V), List[(K, V)])): Option[(List[(K, V)], (K, V), List[(K, V)])] =
  4.       z match {
  5.         case (l, x@(kk, v), r) if k == kk => Some((l, x, r))
  6.         case (_, _, Nil)   => None
  7.         case (l, x, r::rs) => lookupr((x::l, r, rs))
  8.       }
  9.     @?> {
  10.       case Nil => None
  11.       case h::t => lookupr((Nil, h, t)) map {
  12.         case (l, (k, v), r) => (vv => l.reverse ::: (k, vv) :: r, v)
  13.       }
  14.     }
  15.   }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×