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

Can't index result of adverbial [..] #6232

Closed
p6rt opened this issue May 9, 2017 · 3 comments
Closed

Can't index result of adverbial [..] #6232

p6rt opened this issue May 9, 2017 · 3 comments

Comments

@p6rt
Copy link

p6rt commented May 9, 2017

Migrated from rt.perl.org#131279 (status was 'rejected')

Searchable as RT131279$

@p6rt
Copy link
Author

p6rt commented May 9, 2017

From @zoffixznet

When looking up something with `[...]` postcircumfix, you can add more postcircumfixes to index the result​:

  $ perl6 -e 'dd <a b c>[*][1]'
  "b"

But this silently gives wrong results if adverbs are present as well​:

  $ perl6 -e 'dd <a b c>[*]​:p[1]'
  (0 => "a", 1 => "b", 2 => "c")
  $ perl6 -e 'dd <a b c>[*]​:v[1]'
  ("a", "b", "c")
  $ perl6 -e 'dd <a b c>[*]​:exists[1]'
  (Bool​::True, Bool​::True, Bool​::True)
  $ perl6 -e 'dd <a b c>[*]​:p[10000000000000000000000000000000000]'
  (0 => "a", 1 => "b", 2 => "c")
 
  $ perl6 -e 'dd <a b c>[*]​:delete[1]'
  (Failure.new(exception => X​::AdHoc.new(payload => "Can not remove elements from a List"), backtrace => Backtrace.new), Failure.new(exception => X​::AdHoc.new(payload => "Can not remove elements from a List"), backtrace => Backtrace.new), Failure.new(exception => X​::AdHoc.new(payload => "Can not remove elements from a List"), backtrace => Backtrace.new))
 

@p6rt
Copy link
Author

p6rt commented May 11, 2017

From @zoffixznet

On Tue, 09 May 2017 10​:41​:57 -0700, cpan@​zoffix.com wrote​:

When looking up something with `[...]` postcircumfix, you can add more
postcircumfixes to index the result​:

$ perl6 -e 'dd <a b c>[*][1]'
"b"

But this silently gives wrong results if adverbs are present as well​:

$ perl6 -e 'dd <a b c>[*]​:p[1]'
(0 => "a", 1 => "b", 2 => "c")
$ perl6 -e 'dd <a b c>[*]​:v[1]'
("a", "b", "c")
$ perl6 -e 'dd <a b c>[*]​:exists[1]'
(Bool​::True, Bool​::True, Bool​::True)
$ perl6 -e 'dd <a b c>[*]​:p[10000000000000000000000000000000000]'
(0 => "a", 1 => "b", 2 => "c")

$ perl6 -e 'dd <a b c>[*]​:delete[1]'
(Failure.new(exception => X​::AdHoc.new(payload => "Can not remove
elements from a List"), backtrace => Backtrace.new),
Failure.new(exception => X​::AdHoc.new(payload => "Can not remove
elements from a List"), backtrace => Backtrace.new),
Failure.new(exception => X​::AdHoc.new(payload => "Can not remove
elements from a List"), backtrace => Backtrace.new))

Everything works right. I was just too deep into list adverbs and the fact that `​:p[1]` is the syntax for array pair slipped my mind :)

@p6rt
Copy link
Author

p6rt commented May 11, 2017

@zoffixznet - Status changed from 'new' to 'rejected'

@p6rt p6rt closed this as completed May 11, 2017
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