{"id":1199,"date":"2020-12-27T14:38:50","date_gmt":"2020-12-27T19:38:50","guid":{"rendered":"https:\/\/stacyprowell.com\/blog\/?p=1199"},"modified":"2020-12-27T14:39:10","modified_gmt":"2020-12-27T19:39:10","slug":"collections","status":"publish","type":"post","link":"https:\/\/stacyprowell.com\/blog\/2020\/12\/27\/collections\/","title":{"rendered":"Collections"},"content":{"rendered":"\n<p>Relision has hit version 0.6.0, meaning that collections are implemented.  The collections model for Relision is pretty much the same as it was for Elision, with a few tweaks.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>A Relision <em>collection<\/em> is just a collection of terms, along with some algebraic properties.  The properties are the following.<\/p>\n\n\n\n<ul><li>Associativity &#8211; grouping doesn&#8217;t matter; flatten<\/li><li>Commutativity &#8211; order doesn&#8217;t matter; sort<\/li><li>Idempotency &#8211; repeated elements aren&#8217;t allowed; discard them<\/li><li>Identity &#8211; identity doesn&#8217;t change meaning; discard if possible<\/li><li>Absorber &#8211; absorber collapses collection; discard everything else<\/li><li>Element &#8211; all elements must match this type<\/li><li>Guard &#8211; the guard must be TRUE for all elements<\/li><\/ul>\n\n\n\n<p>These are all specified with a relatively cryptic (but compact) form just before the collection of terms.  It is surprisingly generic.  Want a set?  That&#8217;s commutative and idempotent.  Want a bag?  That&#8217;s commutative but <em>not<\/em> idempotent.  Want a list?  That&#8217;s <em>not<\/em> commutative.<\/p>\n\n\n\n<p>The Relision collection actually does a lot of work for you.  If the collection is commutative, then Relision sorts it on creation.  If it is idempotent, it eliminates repeated elements.  If a collection includes the identity, it is discarded (assuming other elements remain).  If there is an absorber, everything <em>else<\/em> is discarded.<\/p>\n\n\n\n<p>Collections are a necessary step on the way to operators, since collections are used to specify the operator&#8217;s parameter and argument lists.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>You can&#8217;t have everything, but given enough time and space you can generate everything except more time and space.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/stacyprowell.com\/blog\/wp-json\/wp\/v2\/posts\/1199"}],"collection":[{"href":"https:\/\/stacyprowell.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/stacyprowell.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/stacyprowell.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/stacyprowell.com\/blog\/wp-json\/wp\/v2\/comments?post=1199"}],"version-history":[{"count":2,"href":"https:\/\/stacyprowell.com\/blog\/wp-json\/wp\/v2\/posts\/1199\/revisions"}],"predecessor-version":[{"id":1201,"href":"https:\/\/stacyprowell.com\/blog\/wp-json\/wp\/v2\/posts\/1199\/revisions\/1201"}],"wp:attachment":[{"href":"https:\/\/stacyprowell.com\/blog\/wp-json\/wp\/v2\/media?parent=1199"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/stacyprowell.com\/blog\/wp-json\/wp\/v2\/categories?post=1199"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/stacyprowell.com\/blog\/wp-json\/wp\/v2\/tags?post=1199"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}