Changes in / [bcef6c8:eaa1759]


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/papers/general/Paper.tex

    rbcef6c8 reaa1759  
    19161916Alternative call syntax (literal argument before routine name) to convert basic literals into user literals.
    19171917
    1918 {\lstset{language=CFA,deletedelim=**[is][]{`}{`},moredelim=**[is][\color{red}]{@}{@}}
     1918{\lstset{language=CFA,moredelim=**[is][\color{red}]{|}{|},deletedelim=**[is][]{`}{`}}
    19191919\begin{cfa}
    19201920struct Weight { double stones; };
     
    19241924Weight ?+?( Weight l, Weight r ) { return (Weight){ l.stones + r.stones }; }
    19251925
    1926 Weight @?`st@( double w ) { return (Weight){ w }; } $\C{// backquote for units}$
    1927 Weight @?`lb@( double w ) { return (Weight){ w / 14.0 }; }
    1928 Weight @?`kg@( double w ) { return (Weight) { w * 0.1575}; }
     1926Weight |?`st|( double w ) { return (Weight){ w }; } $\C{// backquote for units}$
     1927Weight |?`lb|( double w ) { return (Weight){ w / 14.0 }; }
     1928Weight |?`kg|( double w ) { return (Weight) { w * 0.1575}; }
    19291929
    19301930int main() {
    19311931        Weight w, hw = { 14 };                                  $\C{// 14 stone}$
    1932         w = 11@`st@ + 1@`lb@;
    1933         w = 70.3@`kg@;
    1934         w = 155@`lb@;
    1935         w = 0x_9b_u@`lb@;                                               $\C{// hexadecimal unsigned weight (155)}$
    1936         w = 0_233@`lb@;                                                 $\C{// octal weight (155)}$
    1937         w = 5@`st@ + 8@`kg@ + 25@`lb@ + hw;
     1932        w = 11|`st| + 1|`lb|;
     1933        w = 70.3|`kg|;
     1934        w = 155|`lb|;
     1935        w = 0x_9b_u|`lb|;                                               $\C{// hexadecimal unsigned weight (155)}$
     1936        w = 0_233|`lb|;                                                 $\C{// octal weight (155)}$
     1937        w = 5|`st| + 8|`kg| + 25|`lb| + hw;
    19381938}
    19391939\end{cfa}
Note: See TracChangeset for help on using the changeset viewer.