HaloO,

Larry Wall wrote:
Then [X]() also is ()? How about (0,1) X ([]) === (0,1)?

No, that's (0,[]), (1,[1]).  [] *doesn't* flatten in list context.

I guess you meant (0,[]), (1,[]). And you didn't answer what
[X]() returns. Following your arguments this would be undef.


I am genuinely curious as to why anyone who is not a mathematician
would want this?

Well, as an alternate default list. Especially if you are unsure
if a list will be subject to X. This would also be true and still
neutral for concatenation. So we would end up with two identity
elements unless they are equal as far as listhood is concerned.
Hmm, I agree that's all a bit constructed.

Rather than bend the current practical meanings of ()
and [], we possibly have the symbolic concept expressible as none(*).
> We don't define junctions as special in lists, which means it would
> be up to the implementation of infix:<X> to do something with it.

Would '() but .elems(1)' do the trick, too? With overloading X in
mind any type distinct from List would do. E.g. a UnitList singleton
type. But I don't get how none(*) expresses the unit list concept.
Why is none(*).elems == 1 and why (1,2,none(*)) === (1,2)? Would
other junctions behave the same?


But let me reiterate that lists are just lists, not sets.  In fact,
they're closer to bags than sets.  But lists are as much about
ordering as they are about membership.  Please don't take the use
of mathematical language to metaphorically describe the behavior of
infix:<X> as an attempt to confuse you.  :)

I just wondered what mathematical structure (List,infix:<X>) has.
Without an identity element it's just a semigroup. Whereas (List,
infix:<,>) is a monoid with () as identity element. So e.g. I wonder
if there's an isomorphism between that and (Str,infix<~>). But I
agree that I shouldn't bother the list with such things unless I
hope it could be useful for Perl 6 which I hoped for the identity
of X. But seemingly that was a false hope.


Regards, TSa.
--

"The unavoidable price of reliability is simplicity"
  -- C.A.R. Hoare

Reply via email to