repeat

Simon Buerger krox at gmx.net
Mon Jan 17 18:08:18 PST 2011


On 18.01.2011 01:24, spir wrote:
> On 01/17/2011 07:57 PM, Daniel Gibson wrote:
>> IMHO * (multiply) is not good because in theoretical computer science
>> multiply is used to concatenate two words and thus concatenating a word
>> with itself n times is word^n (pow(word, n) in mathematical terms).
>
> Weird. Excuse my ignorance, but how can multiply even mean concat? How
> is this written concretely (example welcome)? Do theoretical computer
> science people find this syntax a Good Thing?
>
> Denis

It is that way for formal languages. {a,b}^2 = {aa,ab,ba,bb}, so only 
used for sets of strings. It is logical there because * means 
something like cartesian product which is a concatenation of all 
combinations of both sets. The notation is not that logical for single 
strings though.

Furthermore, + should mean addition, * should mean multiplication. 
None of them should stand for concatenation. Similar argument led to 
the introduction of the ~ operator in D (which is not present in C++/Java)

just my point of view,
Krox


More information about the Digitalmars-d mailing list