Syntax of &-operator
- Posted by Lutz_Heitmann at NF.MAUS.DE Apr 01, 2001
- 556 views
Hi Euphorians, I don't like the syntax of the &-operator. & is a fine tool to concatenate sequences, but its use is error prone. If you combine variables a and b you get different results, depending on the types of a and b. E.g.: a = 1, b = 3 results in a & b = append({a}, b) a = {1, 2}, b = 3 results in a & b = append(a, b) a = 1, b = {3, 4} results in a & b = prepend(b, a) a = {1, 2}, b = {3, 4} results in a & b = concat(a, b) -- {1, 2, 3, 4} I'm using "concat" for the only usage of "&" that makes sense to me. Of course I don't want something like a & b & c & d (all atoms) to be written like this: append(append(append({a},b),c),d) It could be coded like this: {a} & {b} & {c} & {d} -- "concat" is just too long as a word A little bit more typing but a lot clearer. A lot of programs are using "&" the "old" way, and that can't be changed. But I still don't like it... Lutz.