Changeset 1ccc599 for doc/papers/general
- Timestamp:
- Feb 21, 2018, 12:57:41 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- eaa1759
- Parents:
- 6c7c63c (diff), 599fbb6 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - git-author:
- Peter A. Buhr <pabuhr@…> (02/21/18 12:56:00)
- git-committer:
- Peter A. Buhr <pabuhr@…> (02/21/18 12:57:41)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/papers/general/Paper.tex
r6c7c63c r1ccc599 1916 1916 Alternative call syntax (literal argument before routine name) to convert basic literals into user literals. 1917 1917 1918 {\lstset{language=CFA, deletedelim=**[is][]{`}{`},moredelim=**[is][\color{red}]{@}{@}}1918 {\lstset{language=CFA,moredelim=**[is][\color{red}]{|}{|},deletedelim=**[is][]{`}{`}} 1919 1919 \begin{cfa} 1920 1920 struct Weight { double stones; }; … … 1924 1924 Weight ?+?( Weight l, Weight r ) { return (Weight){ l.stones + r.stones }; } 1925 1925 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}; }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}; } 1929 1929 1930 1930 int main() { 1931 1931 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; 1938 1938 } 1939 1939 \end{cfa}
Note: See TracChangeset
for help on using the changeset viewer.