On Wed, Nov 20, 2002 at 10:35:31PM -0500, Joseph F. Ryan wrote:
: >Does q)hi( really DWIM?? I haven't kept up with it, so I didn't
: >know...that
: >is really odd if so.
: >
:
: Yep, Apoc 5. Personally, I'm not a big fan, but I'm not a language
: designer.
It's because s]foo]bar] is really ugly, and because we didn't want to
make judgements about all the possible Unicode pairings as to whether
you could use them like �� but not like ��.
: >In the one two three example, I thought arrays, when interpolated, did not
: >add spaces between their elements, such that the output should be
: >onetwothree
: >instead of
: >one two three
: >
:
: Well, in perl5, Interpolated lists, join with $", which by default is a
: space. So this:
: "@a"
:
: is actually:
:
: join($",@a)
:
: Whereas "@(@a)" should be treated like:
:
: "".@a.""
:
: Which simply flattens out the list elements. I might be wrong, but at
: least thats how
: I had P6C behave :)
What to interpolate between elements will likely be a property
on the array. By default it should be a space. We may have a
universal method like @a.as('%s',' ') to modify that at the point
of interpolation. Could probably be written @a.join(' ') too.
: >You seem to agree with this in the later array interpolation section where
: >"@(1, 2)" becomes
: >12
: >instead of
: >1 2
: >
: >Does a list still return its last element in scalar context? I thought I
: >remembered something about that changing?
: >
:
: I think you may be right, but thats how P6C behaves.
: Time to send another bug to RT :)
A list in scalar context always returns a reference to the list.
That is, it assumes [...] around it. You have to use ...[-1] to get
the last element of a list.
Larry