\begin{Shaded} \begin{Highlighting}[] \CommentTok{(*有關於LaTeX使用於斷行的演算法} \CommentTok{首先我們要制定一個字元(包含斷行後新生的連字號,以及空白)在斷行前、斷行後的寬度} \CommentTok{*)} \end{Highlighting} \end{Shaded} \begin{Shaded} \begin{Highlighting}[] \CommentTok{(*假設這段字元 wordList,SP表達半形空白,HY表達連字號*)} \KeywordTok{let}\NormalTok{ wordList = [}\StringTok{"no"}\NormalTok{; }\StringTok{"HY"}\NormalTok{; }\StringTok{"thing"}\NormalTok{; }\StringTok{"SP"}\NormalTok{; }\StringTok{"can"}\NormalTok{; }\StringTok{"SP"}\NormalTok{; }\StringTok{"stop"}\NormalTok{;}\StringTok{"SP"}\NormalTok{; }\StringTok{"the"}\NormalTok{; }\StringTok{"SP"}\NormalTok{; }\StringTok{"cro"}\NormalTok{; }\StringTok{"HY"}\NormalTok{; }\StringTok{"co"}\NormalTok{;}\StringTok{"HY"}\NormalTok{ ;}\StringTok{"dile"}\NormalTok{; }\StringTok{"cross"}\NormalTok{; }\StringTok{"SP"}\NormalTok{; }\StringTok{"it."}\NormalTok{] ;;} \end{Highlighting} \end{Shaded} \begin{verbatim} val wordList : string list = ["no"; "HY"; "thing"; "SP"; "can"; "SP"; "stop"; "SP"; "the"; "SP"; "cro"; "HY"; "co"; "HY"; "dile"; "cross"; "SP"; "it."] \end{verbatim} \begin{Shaded} \begin{Highlighting}[] \end{Highlighting} \end{Shaded}