Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

^@list returns ridicously long lists #431

Closed
p6rt opened this issue Nov 25, 2008 · 8 comments
Closed

^@list returns ridicously long lists #431

p6rt opened this issue Nov 25, 2008 · 8 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Nov 25, 2008

Migrated from rt.perl.org#60828 (status was 'resolved')

Searchable as RT60828$

@p6rt
Copy link
Author

p6rt commented Nov 25, 2008

From @moritz

Rakudo r33209​:

my @​a = 1; say (^@​a).elems; # fine
1
my @​a = <jan>; say (^@​a).elems; # ouch
100
my @​a = 'jan'; say (^@​a).elems;
100
my @​a = 'ja'; say (^@​a).elems;
10
my @​a = 'janu'; say (^@​a).elems; # ouch * 10
1000
my @​a = <jan feb>; say (^@​a).elems; # 2 * ouch
200

Moritz

@p6rt
Copy link
Author

p6rt commented Nov 25, 2008

From @moritz

Part of the problem is also that ^@​a returns a List, not a Range.

We now have 6 failing tests in t/spec/S03-operators/context-forcers.t (4
skip, 2 TODO).

@p6rt
Copy link
Author

p6rt commented Nov 25, 2008

@moritz - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Nov 26, 2008

From @pmichaud

Currently Rakudo is treating ^@​list as though it's
prefix​:<^> on a List, which S03 says

  If [prefix​:<^> is] applied to a list, it generates a
  multidimensional set of subscripts.

  for ^(3,3) { ... } # (0,0)(0,1)(0,2)(1,0)(1,1)(1,2)(2,0)(2,1)(2,2)

So, Rakudo is currently seeing ^@​list as following this definition,
and trying to generate the subscripts (perhaps wrongly).

There's still some ambiguity in how (or if) we should support
both interpretations [1], so we'll want to get that resolved before
we can fix prefix​:<^> here.

Thanks,

Pm

[1] http://irclog.perlgeek.de/perl6/2008-11-26#i_720703

@p6rt
Copy link
Author

p6rt commented Nov 26, 2008

From @moritz

Patrick R. Michaud wrote​:

Currently Rakudo is treating ^@​list as though it's
prefix​:<^> on a List, which S03 says

If \[prefix&#8203;:\<^> is\] applied to a list, it generates a
multidimensional set of subscripts\.

for ^\(3,3\) \{ \.\.\. \} \# \(0,0\)\(0,1\)\(0,2\)\(1,0\)\(1,1\)\(1,2\)\(2,0\)\(2,1\)\(2,2\)

So, Rakudo is currently seeing ^@​list as following this definition,
and trying to generate the subscripts (perhaps wrongly).

Yes, wrongly​:
08​:48 < moritz_> rakudo​: say (^(3,3)).perl
08​:48 < p6eval> rakudo 33212​: OUTPUT[[0, 1, 2, 0, 1, 2]␤]
08​:51 < moritz_> rakudo​: say (^(10,3)).perl
08​:51 < p6eval> rakudo 33212​: OUTPUT[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0,
1, 2]␤]

It counts up first the first index, then the second.

I see how the specced makes sense for a List of Ints, but not for any
other list - any ideas from the design team?

Moritz

There's still some ambiguity in how (or if) we should support
both interpretations [1], so we'll want to get that resolved before
we can fix prefix​:<^> here.

[1] http://irclog.perlgeek.de/perl6/2008-11-26#i_720703

@p6rt
Copy link
Author

p6rt commented Nov 27, 2008

From @TimToady

On Wed, Nov 26, 2008 at 08​:54​:50AM +0100, Moritz Lenz wrote​:
:
:
: Patrick R. Michaud wrote​:
: > Currently Rakudo is treating ^@​list as though it's
: > prefix​:<^> on a List, which S03 says
: >
: > If [prefix​:<^> is] applied to a list, it generates a
: > multidimensional set of subscripts.
: >
: > for ^(3,3) { ... } # (0,0)(0,1)(0,2)(1,0)(1,1)(1,2)(2,0)(2,1)(2,2)
: >
: > So, Rakudo is currently seeing ^@​list as following this definition,
: > and trying to generate the subscripts (perhaps wrongly).
:
: Yes, wrongly​:
: 08​:48 < moritz_> rakudo​: say (^(3,3)).perl
: 08​:48 < p6eval> rakudo 33212​: OUTPUT[[0, 1, 2, 0, 1, 2]␤]
: 08​:51 < moritz_> rakudo​: say (^(10,3)).perl
: 08​:51 < p6eval> rakudo 33212​: OUTPUT[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0,
: 1, 2]␤]
:
: It counts up first the first index, then the second.
:
:
: I see how the specced makes sense for a List of Ints, but not for any
: other list - any ideas from the design team?

My guess is that the list overloading will simply vanish into thin air,
and you'll have to say something like

  ^«(3,3)

to get the current Parrot meaning, and

  [X] ^«(3,3)

or

  ^3 X ^3

to get the specced list meaning. But other viewpoints are welcome...

Larry

@p6rt
Copy link
Author

p6rt commented Nov 27, 2008

From @pmichaud

On Wed, Nov 26, 2008 at 06​:21​:22PM -0800, Larry Wall wrote​:

On Wed, Nov 26, 2008 at 08​:54​:50AM +0100, Moritz Lenz wrote​:
: Patrick R. Michaud wrote​:
: > Currently Rakudo is treating ^@​list as though it's
: > prefix​:<^> on a List, which S03 says
: > for ^(3,3) { ... } # (0,0)(0,1)(0,2)(1,0)(1,1)(1,2)(2,0)(2,1)(2,2)
:
: I see how the specced makes sense for a List of Ints, but not for any
: other list - any ideas from the design team?

My guess is that the list overloading will simply vanish into thin air,
and you'll have to say something like

^«\(3,3\)

to get the current Parrot meaning, and

\[X\] ^«\(3,3\)

or

^3 X ^3

to get the specced list meaning. But other viewpoints are welcome...

+1 to the idea that ^@​list is the same as ^+@​list . Now implemented
as such in Rakudo, and unfudged the corresponding tests.

Closing ticket -- thanks!

Pm

@p6rt
Copy link
Author

p6rt commented Nov 27, 2008

@pmichaud - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Nov 27, 2008
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant