2 ms·
> Is there any other common operator you would recommend instead? Yes, wedge product[0], written as tilde (~)[1]: "a"~("b"~"c") = "abc" = ("a"~"b")~"c" # as
by a1369209993 8y ago
> Is there any other common operator you would recommend instead?
Yes, wedge product[0], written as tilde (~)[1]:
"a"~("b"~"c") = "abc" = ("a"~"b")~"c" # associative
"a"~"a"~"a" = "aaa" = "a"^3 # exponentiates with repeat
-"abc" = "cba" # (with - as string reverse)
"ab"~"cd" = -(-"cd" ~ -"ab") # weakly[2] anticommutative
If you generalize to regular expressions, you can get some more milage out of + as alternation and * as intersection.
0: https://en.wikipedia.org/wiki/Wedge_product https://en.wikipedia.org/wiki/Wedge_product
1: Not caret (^), because that makes a good exponentiate operator.
2: # vector wedge product is strongly anticommutative
u~v = -(v~u) = -(-v~-u) # with vector negation