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

BUG: @array.^methods.sort() returns duplicates. #1998

Closed
p6rt opened this issue Aug 2, 2010 · 8 comments
Closed

BUG: @array.^methods.sort() returns duplicates. #1998

p6rt opened this issue Aug 2, 2010 · 8 comments

Comments

@p6rt
Copy link

p6rt commented Aug 2, 2010

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

Searchable as RT76918$

@p6rt
Copy link
Author

p6rt commented Aug 2, 2010

From tom.dignan@gmail.com

Hi Rakudo,

I tested this on rakudo star on Windows 7, but will test it on linux
later as well.

C​:\Users\tom\Code\p6-imap>perl6

Doing this will return the methods as expected​:

@​array.^methods;
new splice perl delete at_pos munch shift map hash fmt flat new rotate pop Captu
re elems Str list exists push unshift batch ACCEPTS eager at_pos sort iterator B
ool Num perl of Str Int list item Num elems fmt lines ucfirst samecase log10 tan
cos capitalize bytes fmt flip p5chop lc to-radians Numeric asinh acotan chr cot
anh acotanh comb floor atan asech acos eval round chop tanh split match exp acos
h words cotan atan2 lcfirst uc sec cis log substr from-radians sprintf trans sin
pred acosec subst sinh cosech acosech abs chomp index ceiling trim asec trim-le
ading unpolar trim-trailing sech ord rand truncate rindex sqrt asin atanh cosh c
osec succ sign chars roots IO reverse keys uniq isa map classify kv min max flat
pick first minmax does rotate join Numeric elems end reduce all Str postcircumf
ix​:<[ ]> postcircumfix​:<{ }> list at_key pairs one ACCEPTS at_pos any sort Seq g
rep none values can bless WHENCE WHERE notdef BUILDALL new Bool print say item
WALK defined BUILD clone perl WHICH Capture CREATE PARROT

Pipe that through unix sort and you'll see there are no duplicates.

Until we introduce rakudo's .sort() function.

new splice perl delete at_pos munch shift map hash fmt flat new rotate pop Captu
re elems Str list exists push unshift batch ACCEPTS eager at_pos sort iterator B
ool Num perl of Str Int list item Num elems fmt lines ucfirst samecase log10 tan
cos capitalize bytes fmt flip p5chop lc to-radians Numeric asinh acotan chr cot
anh acotanh comb floor atan asech acos eval round chop tanh split match exp acos
h words cotan atan2 lcfirst uc sec cis log substr from-radians sprintf trans sin
pred acosec subst sinh cosech acosech abs chomp index ceiling trim asec trim-le
ading unpolar trim-trailing sech ord rand truncate rindex sqrt asin atanh cosh c
osec succ sign chars roots IO reverse keys uniq isa map classify kv min max flat
pick first minmax does rotate join Numeric elems end reduce all Str postcircumf
ix​:<[ ]> postcircumfix​:<{ }> list at_key pairs one ACCEPTS at_pos any sort Seq g
rep none values can bless WHENCE WHERE notdef BUILDALL new Bool print say item
WALK defined BUILD clone perl WHICH Capture CREATE PARROT

One see there are definitely dupes here, easier to see if you do​:

for @​array.^methods.sort() -> $foo { say $foo; }

Thanks,
Tom (shirtless)

@p6rt
Copy link
Author

p6rt commented Aug 2, 2010

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

@p6rt
Copy link
Author

p6rt commented Oct 4, 2011

From @coke

On Sun Aug 01 19​:41​:08 2010, shirtless wrote​:

Hi Rakudo,

I tested this on rakudo star on Windows 7, but will test it on linux
later as well.

C​:\Users\tom\Code\p6-imap>perl6

Doing this will return the methods as expected​:

@​array.^methods;
new splice perl delete at_pos munch shift map hash fmt flat new rotate
pop Captu
re elems Str list exists push unshift batch ACCEPTS eager at_pos sort
iterator B
ool Num perl of Str Int list item Num elems fmt lines ucfirst samecase
log10 tan
cos capitalize bytes fmt flip p5chop lc to-radians Numeric asinh
acotan chr cot
anh acotanh comb floor atan asech acos eval round chop tanh split
match exp acos
h words cotan atan2 lcfirst uc sec cis log substr from-radians sprintf
trans sin
pred acosec subst sinh cosech acosech abs chomp index ceiling trim
asec trim-le
ading unpolar trim-trailing sech ord rand truncate rindex sqrt asin
atanh cosh c
osec succ sign chars roots IO reverse keys uniq isa map classify kv
min max flat
pick first minmax does rotate join Numeric elems end reduce all Str
postcircumf
ix​:<[ ]> postcircumfix​:<{ }> list at_key pairs one ACCEPTS at_pos any
sort Seq g
rep none values can bless WHENCE WHERE notdef BUILDALL new Bool print
say item
WALK defined BUILD clone perl WHICH Capture CREATE PARROT

Pipe that through unix sort and you'll see there are no duplicates.

Until we introduce rakudo's .sort() function.

new splice perl delete at_pos munch shift map hash fmt flat new rotate
pop Captu
re elems Str list exists push unshift batch ACCEPTS eager at_pos sort
iterator B
ool Num perl of Str Int list item Num elems fmt lines ucfirst samecase
log10 tan
cos capitalize bytes fmt flip p5chop lc to-radians Numeric asinh
acotan chr cot
anh acotanh comb floor atan asech acos eval round chop tanh split
match exp acos
h words cotan atan2 lcfirst uc sec cis log substr from-radians sprintf
trans sin
pred acosec subst sinh cosech acosech abs chomp index ceiling trim
asec trim-le
ading unpolar trim-trailing sech ord rand truncate rindex sqrt asin
atanh cosh c
osec succ sign chars roots IO reverse keys uniq isa map classify kv
min max flat
pick first minmax does rotate join Numeric elems end reduce all Str
postcircumf
ix​:<[ ]> postcircumfix​:<{ }> list at_key pairs one ACCEPTS at_pos any
sort Seq g
rep none values can bless WHENCE WHERE notdef BUILDALL new Bool print
say item
WALK defined BUILD clone perl WHICH Capture CREATE PARROT

One see there are definitely dupes here, easier to see if you do​:

for @​array.^methods.sort() -> $foo { say $foo; }

Thanks,
Tom (shirtless)

New failure mode​:

09​:12 < [Coke]> rakudo​: my @​a; say @​a.^methods.sort();
09​:12 <+p6eval> rakudo 7408d6​: OUTPUT«No applicable candidates found to
  dispatch to for 'Numeric'. Available candidates are​:␤​:(Mu, Mu
  %_)␤␤ in method Numeric at src/gen/CORE.setting​:607␤ in sub
  infix​:<==> at src/gen/CORE.setting​:1992␤ in sub infix​:<cmp> at
  src/gen/CORE.setting​:1035␤ in method sort …

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented May 29, 2012

From @diakopter

This is now working. marking testneeded.

13​:22 <diakopter> rakudo​: my @​a; say @​a.^methods.sort();
13​:22 <p6eval> rakudo e2d876​: OUTPUT«ACCEPTS Bool Capture DUMP
FLATTENABLE_HASH
  FLATTENABLE_LIST Int Int Num Numeric Numeric
PARAMETERIZE_TYPE Parcel REIFY
  REIFY STORE STORE_AT_POS STORE_AT_POS Str Str at_pos at_pos
bind_pos
  categorize chrs classify delete eager elems elems end
exists flat flattens
  fl…

@p6rt
Copy link
Author

p6rt commented May 29, 2012

From @diakopter

nm I'm wrong. unmarking testneeded.

@p6rt
Copy link
Author

p6rt commented Aug 7, 2012

From @moritz

Works now. Closing without test, because testing it reliably would be an
effort out of proportion.

@p6rt p6rt closed this as completed Aug 7, 2012
@p6rt
Copy link
Author

p6rt commented Aug 7, 2012

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

@p6rt
Copy link
Author

p6rt commented Aug 7, 2012

From @moritz

Oh, I forgot to say​: multiple methods of the same name are OK, they
simply come from superclasses. If you don't want to include them, use
@​array.^methods(​:local).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant