doc-src/Logics/HOL.tex
changeset 3181 3f7f4a7ae1d1
parent 3180 3fff6839c616
child 3287 078be5581967
equal deleted inserted replaced
3180:3fff6839c616 3181:3f7f4a7ae1d1
  1718 \end{ttbox}
  1718 \end{ttbox}
  1719 
  1719 
  1720 
  1720 
  1721 \subsubsection{The datatype $\alpha~mylist$ with mixfix syntax}
  1721 \subsubsection{The datatype $\alpha~mylist$ with mixfix syntax}
  1722 
  1722 
  1723 In this example we define the type $\alpha~mylist$ again but this time we want
  1723 In this example we define the type $\alpha~mylist$ again but this time
  1724 to write {\tt []} instead of {\tt Nil} and we want to use the infix operator
  1724 we want to write {\tt []} for {\tt Nil} and we want to use infix
  1725 \verb|#| instead of {\tt Cons}. To do this we simply add mixfix annotations
  1725 notation \verb|#| for {\tt Cons}. To do this we simply add mixfix
  1726 after the constructor declarations as follows:
  1726 annotations after the constructor declarations as follows:
  1727 \begin{ttbox}
  1727 \begin{ttbox}
  1728 MyList = HOL +
  1728 MyList = HOL +
  1729   datatype 'a mylist =
  1729   datatype 'a mylist =
  1730     Nil ("[]")  |
  1730     Nil ("[]")  |
  1731     Cons 'a ('a mylist)  (infixr "#" 70)
  1731     Cons 'a ('a mylist)  (infixr "#" 70)