rebcabin / masr

Meta ASR: replacement for aging ASDL
MIT License
4 stars 0 forks source link

identifier* versus dimension* #1

Open rebcabin opened 1 year ago

rebcabin commented 1 year ago

I'm assuming that dimension* is an ordered collection of dimension instances. I'll also assume that identifier* is an unordered collection of identifier instances with no duplicates, i.e., a set. @lcompilers, please close this issue if identifier* should be a set, otherwise discuss :)

certik commented 1 year ago

identifier* in ASDL is an ordered list and it can have duplicates.

In practice, we use (using the terminology from the next comment below):

rebcabin commented 1 year ago

Ok, great. The type identifier* is not sufficiently discriminating. There exist four (and only four) collection types:

  1. set, unordered, no duplicates, Clojure syntax #{...}
  2. bag, unordered, duplicates, no built-in Clojure abstraction
  3. suit, aka permutation: ordered, no duplicates, no built-in Clojure abstraction
  4. list, aka sequence, tuple: ordered, duplicates, Clojure syntax [], ()

I'll add these to MASR so we can have precise, discriminating types for collections.

rebcabin commented 1 year ago

Lengthy explanation of the four collection types

There may be some lessons on ASR->ASR transformations and optimization in there.

(that tutorial summarizes about 20,000 PhD theses from the 1980's, when monoids were in fashion for understanding databases. Monoids are no longer in fashion and one most likely not earn a PhD even for a novel discovery in monoid.)

(I claim that, while mathematical, the treatise has practical ramifications on the efficient calculation of queries, such as the requirement for hash-tables for operations on suits [permutations]).

rebcabin commented 1 year ago

fixed in main

c0080c0 (HEAD -> main, origin/main, origin/HEAD) identifier-suit
e6af185 add identifier-list
0811a05 bug fix identifier-set
certik commented 1 year ago

I updated my comment above (https://github.com/rebcabin/masr/issues/1#issuecomment-1502442677) to add the terminology from your comment.

rebcabin commented 1 year ago

reopening as documentation reminder as requested by @certik