daily pastebin goal
11%
SHARE
TWEET

Untitled

a guest Jul 12th, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def withBufferedWriter(file: File)(block: BufferedWriter -> Unit)
  2.    
  3. withBufferedWriter(new File("myfile.txt")) { out =>
  4.   out write "whatever"
  5.   ...
  6. }
  7.    
  8. scala> def foo(as: Int*)(bs: Int*)(cs: Int*) = as.sum * bs.sum * cs.sum
  9. foo: (as: Int*)(bs: Int*)(cs: Int*)Int
  10.  
  11. scala> foo(1, 2, 3)(4, 5, 6, 7, 9)(10, 11)
  12. res7: Int = 3906
  13.    
  14. (A, B, C, D, E) => F
  15. ((A, B), (C, D, E)) => F
  16. (A, B) => (C, D, E) => F
  17.    
  18. scala> def foo(a:Int, b:Int)(c:Int, d:Int, e:Int):Int = 9
  19. foo: (a: Int,b: Int)(c: Int,d: Int,e: Int)Int
  20.  
  21. scala> foo _                                            
  22. res4: (Int, Int) => (Int, Int, Int) => Int = <function2>
  23.    
  24. def foo[T](a: T, b: T)(op: (T,T)=>T) = op(a,b)
  25. foo(1,2){_+_}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top