Changeset 84886499
- Timestamp:
- Mar 26, 2024, 1:06:38 PM (13 months ago)
- Branches:
- master
- Children:
- 67467a3
- Parents:
- 7b05de4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified doc/theses/jiada_liang_MMath/relatedwork.tex ¶
r7b05de4 r84886499 2236 2236 \end{ocaml} 2237 2237 The only operations are binding and pattern matching (equality), where the variant name is logically the implementation tag stored in the union for discriminating the value in the object storage. 2238 OCaml compile store tags as ascending int, starting from 0. Variants @Mon@ to @Sun@ are stored as int value 0 to 6.2238 After compilation, variant names are mapped to an opague ascending intergral type discriminants, starting from 0. 2239 2239 Here, function @take_class@ has a @weekday@ parameter, and returns @"CS442"@, if the weekday value is @Mon@ or @Wed@, @"CS343"@, if the value is @Tue@ or @Thu@, and @"Tutorial"@ for @Fri@. 2240 2240 The ``@_@'' is a wildcard matching any @weekday@ value, so the function returns @"Take a break"@ for values @Sat@ or @Sun@, which are not matched by the previous cases.
Note: See TracChangeset
for help on using the changeset viewer.