cws/pre_cw03.tex
changeset 367 24f86eb53259
parent 356 35c75b594459
child 379 73ad2e018516
equal deleted inserted replaced
366:d2f895c1dba6 367:24f86eb53259
    51 $ scala -cp postfix.jar
    51 $ scala -cp postfix.jar
    52 
    52 
    53 scala> CW8a.syard(CW8a.split("( 5 + 7 ) * 2"))
    53 scala> CW8a.syard(CW8a.split("( 5 + 7 ) * 2"))
    54 val res0: CW8a.Toks = List(5, 7, +, 2, *)
    54 val res0: CW8a.Toks = List(5, 7, +, 2, *)
    55 \end{lstlisting}%$
    55 \end{lstlisting}%$
       
    56 
       
    57 
       
    58 \subsection*{Hints}
       
    59 
       
    60 \noindent
       
    61 \textbf{For the Preliminary Part:} useful operations for determining
       
    62 whether a string is a number are \texttt{.forall} and \texttt{.isDigit}.
       
    63 One way to calculate the the power operation is to use \texttt{.pow}
       
    64 on \texttt{BigInt}s, like \texttt{BigInt(n).pow(m).toInt}.
       
    65 \bigskip
    56 
    66 
    57 
    67 
    58 \subsection*{Preliminary Part (3 Marks, files postfix.scala, postfix2.scala)}
    68 \subsection*{Preliminary Part (3 Marks, files postfix.scala, postfix2.scala)}
    59 
    69 
    60 The \emph{Shunting Yard Algorithm} has been developed by Edsger Dijkstra,
    70 The \emph{Shunting Yard Algorithm} has been developed by Edsger Dijkstra,