cws/cw02.tex
changeset 301 c3b33c709696
parent 284 9a04eb6a2291
child 306 1877cc717291
equal deleted inserted replaced
300:72688efdf17c 301:c3b33c709696
    70 integers, \texttt{.max} calculates the maximum of a list.\bigskip
    70 integers, \texttt{.max} calculates the maximum of a list.\bigskip
    71 
    71 
    72 \noindent
    72 \noindent
    73 \textbf{For Part 2:} use \texttt{.split(",").toList} for splitting
    73 \textbf{For Part 2:} use \texttt{.split(",").toList} for splitting
    74 strings according to commas (similarly $\backslash$\texttt{n}),
    74 strings according to commas (similarly $\backslash$\texttt{n}),
    75 \texttt{.getOrElse(..,..)} allows to querry a Map, but also gives a
    75 \texttt{.getOrElse(..,..)} allows to query a Map, but also gives a
    76 default value if the Map is not defined, a Map can be `updated' by
    76 default value if the Map is not defined, a Map can be `updated' by
    77 using \texttt{+}, \texttt{.contains} and \texttt{.filter} can test whether
    77 using \texttt{+}, \texttt{.contains} and \texttt{.filter} can test whether
    78 an element is included in a list, and respectively filter out elements in a list,
    78 an element is included in a list, and respectively filter out elements in a list,
    79 \texttt{.sortBy(\_.\_2)} sorts a list of pairs according to the second
    79 \texttt{.sortBy(\_.\_2)} sorts a list of pairs according to the second
    80 elements in the pairs---the sorting is done from smallest to highest,
    80 elements in the pairs---the sorting is done from smallest to highest,