1. my class WhateverCode is Code {
  2. # helper method for array slicing
  3. method pos(WhateverCode:D $self: \list) {
  4. nqp::if(
  5. nqp::iseq_i(
  6. nqp::getattr(
  7. nqp::getattr($self,Code,'$!signature'),
  8. Signature,
  9. '$!count'
  10. ),1),
  11. $self(nqp::if(nqp::isconcrete(list),list.elems,0)),
  12. $self(|(nqp::if(nqp::isconcrete(list),list.elems,0)
  13. xx nqp::getattr(
  14. nqp::getattr($self,Code,'$!signature'),
  15. Signature,
  16. '$!count'
  17. )
  18. ))
  19. )
  20. }
  21. }