Skip to content

Instantly share code, notes, and snippets.

@KamilLelonek
Last active August 29, 2015 14:10
Show Gist options
  • Save KamilLelonek/d06015c5e0e5900c8ccd to your computer and use it in GitHub Desktop.
Save KamilLelonek/d06015c5e0e5900c8ccd to your computer and use it in GitHub Desktop.
An attempt for better Array syntax in Scala
import scala.language.reflectiveCalls
import scala.language.postfixOps
import scala.reflect.Manifest
import scala.reflect.ClassTag
def |[T: ClassTag](x: T*) = new { def | = x.toArray }
val a = |(1, 2, 3)|
val b = |("a", "b", "c")|
val c = |(true, false)|
val d = |(1, "a", true)|
@KamilLelonek
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment