handouts/amm-ho.tex
changeset 759 d70dd0b57e35
parent 756 f7c7a75e0583
child 760 d41956ea544e
equal deleted inserted replaced
758:194218161b71 759:d70dd0b57e35
    43 \end{lstlisting} %% $
    43 \end{lstlisting} %% $
    44 
    44 
    45 \noindent
    45 \noindent
    46 Ammonite uses the same Scala compiler, just adds some useful features
    46 Ammonite uses the same Scala compiler, just adds some useful features
    47 on top of it. It is quite main-stream in the Scala community and it should
    47 on top of it. It is quite main-stream in the Scala community and it should
    48 therefore be very easy for you to install \texttt{amm}.  The big
    48 therefore be very easy for you to install \texttt{amm}.
    49 advantage of Ammonite is that it comes with some additional libraries
    49 
    50 already built-in and also allows one to easily break up code into
    50 The big advantage of Ammonite is that it comes with some additional
    51 smaller modules. For example reading and writing files in Ammonite can
    51 libraries already built-in and also allows one to easily break up code
    52 be achieved with
    52 into smaller modules. For example reading and writing files in
       
    53 Ammonite can be achieved with
    53 
    54 
    54 \begin{lstlisting}[numbers=none,language=Scala]
    55 \begin{lstlisting}[numbers=none,language=Scala]
    55 scala> import ammonite.ops._
    56 scala> import ammonite.ops._
    56   
    57   
    57 scala> read(pwd / "file.name")   
    58 scala> read(pwd / "file.name")   
    59 
    60 
    60 scala> write.over(pwd / "file.name", "foo bar")
    61 scala> write.over(pwd / "file.name", "foo bar")
    61 \end{lstlisting}
    62 \end{lstlisting}
    62 
    63 
    63 \noindent
    64 \noindent
    64 For loading and accessing code from another Scala file, you can import it
    65 The latter writes the string \code{"foo bar"} into the file
    65 as follows:
    66 \code{"file.name"}, which is located in the current working
       
    67 directory. For loading and accessing code from another Scala file, you
       
    68 can import it as follows:
    66 
    69 
    67 \begin{lstlisting}[numbers=none,language=Scala]
    70 \begin{lstlisting}[numbers=none,language=Scala]
    68 import $file.name-of-the-file
    71 import $file.name-of-the-file
    69 import name-of-the-file._
    72 import name-of-the-file._
    70 \end{lstlisting}  %% $
    73 \end{lstlisting}  %% $