Skip to content

Commit

Permalink
doc fixes + additions
Browse files Browse the repository at this point in the history
  • Loading branch information
byorgey committed Dec 25, 2024
1 parent 941a09e commit 43a72ca
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
14 changes: 8 additions & 6 deletions docs/reference/bag.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ Bags
====

For any :doc:`type <types>` ``T``, ``Bag(T)`` is the type of *finite
bags* with elements of type ``T``. A bag is like a :doc:`set` (and
unlike a :doc:`list`) in that it doesn't care about the order of the
elements; however, unlike a :doc:`set`, a bag cares *how many copies*
bags* with elements of type ``T``. A bag is like a :doc:`set <set>` (and
unlike a :doc:`list <list>`) in that it doesn't care about the order of the
elements; however, unlike a :doc:`set <set>`, a bag cares *how many copies*
of each element there are.

* The built-in ``bag`` function can be used to convert other
Expand Down Expand Up @@ -96,9 +96,11 @@ of each element there are.
Disco> 2 ∈ ⟅1,2,3⟆
T

Bags support various operations, including :doc:`size <size>`,
:doc:`union <collection-ops>`, :doc:`intersection <collection-ops>`,
:doc:`difference <collection-ops>`, :doc:`subset <collection-ops>`, and :doc:`power set <power>`.
Bags support various operations common to other collection types,
including :doc:`size <size>`, :doc:`union <collection-ops>`,
:doc:`intersection <collection-ops>`, :doc:`difference
<collection-ops>`, :doc:`subset <collection-ops>`, and :doc:`power set
<power>`.

Converting to and from sets
---------------------------
Expand Down
2 changes: 2 additions & 0 deletions docs/reference/symbols.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,6 @@ with a link to the relevant Disco documentation.
⌋ U+230B ``\rfloor`` ``floor`` :doc:`Floor <round>`
⌈ U+2308 ``\lceil`` ``ceiling`` :doc:`Ceiling <round>`
⌉ U+2309 ``\rceil`` ``ceiling`` :doc:`Ceiling <round>`
⟅ U+27C5 ``\Lbag`` ``bag`` :doc:`Bags <bag>`
⟆ U+27C6 ``\Rbag`` ``bag`` :doc:`Bags <bag>`
====== ================= ================= ================ ====================================
11 changes: 10 additions & 1 deletion src/Disco/Doc.hs
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,14 @@ docMap =
, OtherKey "Prop" ==>
"The type of propositions." ==>
[mkRef "prop"]
, OtherKey "List" ==>
"List(T) is the type of lists whose elements have type T." ==>
[mkRef "list", mkRef "list-lib"]
, OtherKey "Bag" ==>
"Bag(T) is the type of bags (i.e. sets with multiplicity) whose elements have type T." ==>
[mkRef "bag", mkRef "symbols"]
, OtherKey "Set" ==>
"The type of finite sets." ==>
"Set(T) is the type of finite sets whose elements have type T." ==>
[mkRef "set", mkRef "symbols"]
, OtherKey "|~|" ==>
"Absolute value, or the size of a collection." ==>
Expand All @@ -182,6 +188,9 @@ docMap =
, OtherKey "λ" ==>
"λ (aka lambda, alternatively `\\`) introduces an anonymous function." ==>
[mkRef "anonymous-func", mkRef "symbols"]
, OtherKey "#" ==>
"The # character is used to denote the cardinality of an element in a bag." ==>
[mkRef "bag"]
]
where
docN = ("The type of natural numbers: 0, 1, 2, ...", refsN)
Expand Down

0 comments on commit 43a72ca

Please sign in to comment.