I want to do a long series of manipulations on words in abstract generators.
I can't decide whether to convert the words to lists of integers or not.
On the one hand, I find that
is considerably quicker than
(presumably chiefly because SubstitutedWord does a copy, rather than
substituting in place).
On the other hand,
w:=SubstitutedWord(w,3,3,b^3); or w:=SubstitutedWord(w,2,4,b);
works out quicker than the corresponding operation on lists, because to do
it with lists in general, you have to write an inner loop to shift the end of
the word to the left or right, depending on whether the substituted string is
longer or shorter.
My queries are then
(i) Is there a better way of doing things which I don't know about?
(ii) If not, can I put in plea for the future provision of a
"SubstitutedWord" function which operates on its argument in place, rather
than copying and returning a new word.
I realise that word operations also have to check for possible cancellation
with inverses in the underlying free group, but that shouldn't make such a
big difference. In any case, I hope that free monoids will eventually be
supported in GAP, where inverse do not arise.