Chas Owens wrote:
Jonathan Lang wrote:
> Is there any reason why we can't simply define '$a x $n' as being
> shorthand for 'cat($a xx $n)'?  In what way does the former differ
> from the latter, other than the use of a Whatever in place of $n?

"$a x $n" is equivalent to "join '', $a xx $n", but that isn't an apt
description of its behavior.  "cat($a xx *)" is an attempt to provide
an infinite string since 'a' x Inf would result in memory overflow
(but the cat trick works since lists are evaluated lazily).

Then it looks to me like 'cat($a xx $n)' is more flexible than "join
'', $a xx $n", and would work better as the baseline definition for
'$a x $n'.  Is there any reason to prefer a join-based definition to a
cat-based one?  AFAICT, the only thing that 'join' can do that 'cat'
can't is to provide a delimiter when stitching the component strings
together; in the case of 'x', this feature is (rightfully) not being
used.

--
Jonathan "Dataweaver" Lang

Reply via email to