Ordered operations and pointers #26

Open
opened 2025-10-13 23:58:27 +00:00 by UserCurt · 0 comments
UserCurt commented 2025-10-13 23:58:27 +00:00 (Migrated from codeberg.org)

This issue proposes that the mpath operations are ordered, and the mpath pointers are ordered. They would implement
inequality operations (>, <, >=, <=) and the sort method. This is already implemented to some degree, though this issue is put forward to account for the implementation of other operations in the future.

Inter-operation comparisons should satisfy this ordering: CommaSeparatedListIndex < Brace (#5) < Paren (#5) < DotIndex (#2) < DotExact < DotGlob < DotRegex (#4) < DotSet (#3) < Identity

Intra-operation comparisons should follow the closest thing to lexicographic order:

  • CommaSeparatedListIndex and DotIndex: If A has fewer elements than B, then A<B. Otherwise, compare entries left-to-right until there is a difference.
  • Brace and Paren: If A has fewer dimensions than B, then A<B. Otherwise, compare left-to-right until a difference is found. If A{i} has fewer dimensions than B{i}, then A(i) < B(i). Otherwise, compare left-to-right until a difference is found. If A{i}(j) has fewer entries than B{i}(j), then A(i){j} < B(i){j}.
  • DotExact: Compare strings directly with standard lexicographic ordering.
  • DotGlob: If there are no wildcards, treat as a DotExact. Otherwise, compare strings directly with standard lexicographic ordering with one exception on the character-level: letters < '?' < '*'
  • DotRegex: Compare strings directly with standard lexicographic ordering. Unless there is a better way.
  • DotSet: If A has fewer elements than B, then A<B. Otherwise, compare entries left-to-right until there is a difference.
  • Identity: Always false, similar to missing

Comparisons between mpath pointers should follow something similar to lexicographic order being composed of operations. If A has fewer operations than B, then A<B. Otherwise, compare left-to-right until a difference is found between operations.

This issue proposes that the mpath operations are ordered, and the mpath pointers are ordered. They would implement inequality operations (`>`, `<`, `>=`, `<=`) and the `sort` method. This is already implemented to some degree, though this issue is put forward to account for the implementation of other operations in the future. Inter-operation comparisons should satisfy this ordering: CommaSeparatedListIndex < Brace (#5) < Paren (#5) < DotIndex (#2) < DotExact < DotGlob < DotRegex (#4) < DotSet (#3) < Identity Intra-operation comparisons should follow the closest thing to lexicographic order: - **CommaSeparatedListIndex** and **DotIndex**: If `A` has fewer elements than `B`, then `A<B`. Otherwise, compare entries left-to-right until there is a difference. - **Brace** and **Paren**: If `A` has fewer dimensions than `B`, then `A<B`. Otherwise, compare left-to-right until a difference is found. If `A{i}` has fewer dimensions than `B{i}`, then `A(i) < B(i)`. Otherwise, compare left-to-right until a difference is found. If `A{i}(j)` has fewer entries than `B{i}(j)`, then `A(i){j} < B(i){j}`. - **DotExact**: Compare strings directly with standard lexicographic ordering. - **DotGlob**: If there are no wildcards, treat as a DotExact. Otherwise, compare strings directly with standard lexicographic ordering with one exception on the character-level: `letters < '?' < '*'` - **DotRegex**: Compare strings directly with standard lexicographic ordering. Unless there is a better way. - **DotSet**: If `A` has fewer elements than `B`, then `A<B`. Otherwise, compare entries left-to-right until there is a difference. - **Identity**: Always false, similar to `missing` Comparisons between mpath pointers should follow something similar to lexicographic order being composed of operations. If `A` has fewer operations than `B`, then `A<B`. Otherwise, compare left-to-right until a difference is found between operations.
Sign in to join this conversation.
No description provided.