class Database { class Info } class Foo(db : Database) { val info = new db.Info }
Scala 源代码
Scala,一种兼具面向对象与函数式编程特性的高级语言,以其简洁优雅的语法、强大的并发处理能力及与Java生态系统的无缝集成而闻名。广泛应用于大数据处理、Web开发以及构建高性能服务器等领域。对于电子工程师而言,掌握Scala不仅能够提升个人编程技能,还能在设计复杂系统时提供更灵…
object Test { class Foo(x: Foo) { def this() = this(this); } def main(args: Array[String]): Unit = { new Foo(); } …
class InL[A, B] class Fix[Op[A]](x : Op[Fix[Op]]) class FixTest { val zero = new Fix(new InL) }
object Test { def idMap[C[_],T](m: { def map[U](f: T => U): C[U] }): C[T] = m.map(t => t) idMap(Some(0)) }
object foo { case class Bar(a:String, b:Object, c:String*); Bar("foo","meets","bar") match { case Bar("foo",_*) => erro…
object Test { case class Y[T1, T2
/* The Computer Language Shootout http://shootout.alioth.debian.org/ contributed by Isaac Gouy */ import scala.collection.m…
/* The Computer Language Shootout http://shootout.alioth.debian.org/ contributed by Philipp Haller */ import scala.actors._…
/* * The Computer Language Shootout * http://shootout.alioth.debian.org/ * * contributed by Andrei Formiga */ /* functional …
/* The Computer Language Shootout http://shootout.alioth.debian.org/ contributed by Isaac Gouy */ object SpectralNorm { …