Monday, November 26, 2012

Collections of monoid elements

All collections can be produced by monoids, for example, the concat operation produces ordered collections:
(= (concat '(1 2 3) '(4 5))
   '(1 2 3 4 5))
Although monoids describe how to build these collections, places are needed in order to describe how to represent them. The nth place is used to describe ordered collections:
(= '(1 2 3)
   {(nth 0) 1
    (nth 1) 2
    (nth 2) 3})
Multisets are produced by commutative monoids, and sets are produced by idempotent commutative monoids. Unordered collections are described by multiplicities. Furthermore, nil represents the empty collection.
(= (list-to-multiset '(1 1 2 3))
   {1 2, 2 1, 3 1})
In partially commutative monoids unordered collections and ordered collections can be combined together to form a partially commutative collection.

No comments:

Post a Comment