Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Nov 29th, 2010  |  syntax: Scala  |  size: 0.71 KB  |  views: 27  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. mixer.scala:
  2. def mixer2(begin: String, beginings: String*) = new {
  3.   def apply(end: String, endings: String*) = {
  4.     println(new Exception().getStackTrace().take(6).mkString("\n"))
  5.     for (b <- (begin +: beginings); e <- (end +: endings)) yield b+e
  6.   }
  7. }
  8. def isThisReflection()=mixer2("a", "z")("A", "Z")
  9.  
  10. isThisReflection()
  11.  
  12.  
  13. > scala mixer.scala
  14. Main$$anon$1$$anon$2.apply(mixer.scala:3)
  15. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  16. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  17. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  18. java.lang.reflect.Method.invoke(Method.java:597)
  19. Main$$anon$1.isThisReflection(mixer.scala:7)