Skip to content

drunkwater/scala

Repository files navigation

Scala

website

http://www.scala-lang.org/old/node/219

Simple Snippets

  1. abstractTypes.scala An example of how abstract types are used in a program

  2. bigint.scala User-defined integers, BigInts, are used seamlessly

  3. complexOps.scala Operators can be defined on user-defined classes, here complex numbers

  4. for-yield.scala An example of the for and yield constructs

  5. extendBuiltins.scala Adding "!" as a new method on integers

  6. implicits.scala Define a new method 'sort' on arrays without changing their definition

  7. maps.scala Maps are easy to use in Scala

  8. match.scala Using pattern matching to recognize command line arguments

  9. primes.scala A simple, although inefficient, way to calculate prime numbers

  10. sum.scala Calculates the sum of the arguments supplied on the command line

  11. varargs.scala Java varargs can be easily used in Scala as well

Scala Examples - Advanced

  1. addressbook.scala Address book to XHTML code (see also XML Processing)

  2. callccInterpreter.scala Interpreter with continuations using monads

  3. fors.scala for comprehensions (see also Sequence Comprehensions)

  4. gadts.scala Generalised algebraic data types

  5. lazyEvaluation.scala Lazy evaluation

  6. message.scala Actors (see also Actors for Scala)

  7. patterns.scala Pattern matching using case classes (see also Case Classes)

  8. extractorPatterns.scala Pattern matching using extractors - a flexible way of matching objects with patterns

  9. pingpong.scala Actors (see also Actors for Scala)

  10. properties.scala Properties

  11. random.scala Client/server application using Java sockets

  12. simpleInterpreter.scala Simple interpreter using monads

  13. sort.scala Recursive quicksort algorithm (imperative solution, see also Nested Functions)

  14. sort1.scala Recursive quicksort algorithm (functional solution)

  15. timeofday.scala Properties (see example 1 in § 4.2 of the Scala Language Specification)

  16. vectors.scala Vector operations using views (see also Views)

  17. brainf_ck.scala A small Brainf*ck interpreter

Notes

Application has been deprecated from scala 2.9, probably it has been deleted in scala 2.11 (it still exists in scala 2.10) even though at the moment I can't find proofs for that, use App instead.

About

scala example

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published