Movatterモバイル変換


[0]ホーム

URL:


This page is no longer maintained — Please continue to the home page atwww.scala-lang.org

Home

Scala Main Menu

Home »Code Examples » Advanced Examples

Scala Examples - Advanced

Created by admin on 2008-07-03. Updated: 2010-02-22, 14:52
SourceDescription
addressbook.scalaAddress book to XHTML code (see alsoXML Processing)
callccInterpreter.scalaInterpreter with continuations using monads
fors.scalafor comprehensions (see alsoSequence Comprehensions)
gadts.scalaGeneralised algebraic data types
lazyEvaluation.scalaLazy evaluation
message.scalaActors (see also Actors for Scala)
patterns.scalaPattern matching using case classes (see alsoCase Classes)
extractorPatterns.scalaPattern matching using extractors - a flexible way of matching objects with patterns
pingpong.scalaActors (see also Actors for Scala)
properties.scalaProperties
random.scalaClient/server application using Java sockets
simpleInterpreter.scalaSimple interpreter using monads
sort.scalaRecursive quicksort algorithm (imperative solution, see alsoNested Functions)
sort1.scalaRecursive quicksort algorithm (functional solution)
timeofday.scalaProperties (see example 1 in § 4.2 of theScala Language Specification)
vectors.scalaVector operations using views (see alsoViews)
brainf_ck.scalaA small Brainf*ck interpreter

 

To compile and run on Windows one of the above Scala programs, let's say sort.scala, we can simply proceed as follows:

> mkdir classes> scalac -d classes %SCALA_HOME%\doc\scala-devel\scala\examples\sort.scala> scala -cp classes examples.sort[6,2,8,5,1][1,2,5,6,8]

The name of the Scala executable is examples.sort where examples is the name of the package containing the sortobject. Running the test on a Unix system is very much similar, except for the use of slashes instead of backslashes, and a different specification of the Scala home directory.

 

Other Scala examples

Finally, the following ressources contain Scala examples as well:

  • TheScala distribution contains a directoryexamples with other source examples.
  • The documentScala By Example (about 150 pages, available in PDF format) contains more advanced Scala examples.
  • The Scala Wiki contains many other code examples.

 

Scala Quick Links

Featured News

User login


will be sent securely

Create new account

Retrieve lost password

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland


[8]ページ先頭

©2009-2026 Movatter.jp