mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-25 06:18:05 +02:00
scala
This commit is contained in:
parent
7efffcec0c
commit
7a39159bdb
5 changed files with 19 additions and 10 deletions
Binary file not shown.
|
@ -1,8 +1,7 @@
|
|||
\chapter{Scala}
|
||||
\index{Scala|(}
|
||||
|
||||
Scala ist eine funktionale Programmiersprache, die auf der JVM aufbaut
|
||||
und in Java Bytecode kompiliert wird. Scala bedeutet \underline{sca}lable
|
||||
Scala ist eine objektorientierte und funktionale Programmiersprache, die auf der JVM aufbaut und in Java Bytecode kompiliert wird. Scala bedeutet \underline{sca}lable
|
||||
\underline{la}nguage.
|
||||
|
||||
Mit sog. \enquote{actors} bietet Scala eine Unterstützung für die Entwicklung
|
||||
|
@ -13,12 +12,12 @@ Weitere Materialien sind unter \url{http://www.scala-lang.org/} und
|
|||
|
||||
\section{Erste Schritte}
|
||||
Scala kann auf Debian-basierten Systemen durch das Paket \texttt{scala} installiert
|
||||
werden.
|
||||
werden. Für andere Systeme stehen auf \url{http://www.scala-lang.org/download/}
|
||||
verschiedene Binärdateien bereit.
|
||||
|
||||
\subsection{Hello World}
|
||||
\subsubsection{Interaktiv}
|
||||
Folgendes Beispiel stammt von \url{http://wiki.ubuntuusers.de/Scala}.
|
||||
\inputminted[linenos, numbersep=5pt, tabsize=4, frame=lines, label=scala-test.scala]{scala}{scripts/scala/scala-test.scala}
|
||||
\inputminted[numbersep=5pt, tabsize=4]{bash}{scripts/scala/scala-test.scala}
|
||||
Es kann mit \texttt{./scala-test.scala Scala funktioniert} ausgeführt werden.
|
||||
|
||||
\subsubsection{Kompiliert}
|
||||
|
@ -69,7 +68,14 @@ Methoden werden mit dem Schlüsselwort \texttt{def}\xindex{def} erzeugt:
|
|||
Klassen werden wie folgt erstellt:
|
||||
\inputminted[numbersep=5pt, tabsize=4]{scala}{scripts/scala/simple-class-example.scala}
|
||||
|
||||
und so instanziiert:
|
||||
\inputminted[numbersep=5pt, tabsize=4]{scala}{scripts/scala/simple-class-instanciation.scala}
|
||||
|
||||
\section{Beispiele}
|
||||
|
||||
\section{Weitere Informationen}
|
||||
\begin{itemize}
|
||||
\item \url{http://docs.scala-lang.org/style/naming-conventions.html}
|
||||
\end{itemize}
|
||||
|
||||
\index{Scala|)}
|
|
@ -1,6 +1,5 @@
|
|||
#!/usr/bin/env scala
|
||||
!#
|
||||
def promptprint (s: String) = {println ("> " + s)}
|
||||
$ scala
|
||||
Welcome to Scala version 2.9.2 [...]
|
||||
|
||||
println ("Hallo ")
|
||||
args foreach promptprint
|
||||
scala> println("Hello world")
|
||||
Hello world
|
|
@ -3,4 +3,6 @@ class Person (
|
|||
var lastName: String,
|
||||
age: Int) {
|
||||
println("This is the constructur.")
|
||||
|
||||
def sayHi() = println("Hello world!")
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
val anna = new Person("anna", "bern", 18)
|
||||
anna.sayHi()
|
Loading…
Add table
Add a link
Reference in a new issue