# Pastebin fYK6sZos use nqp; sub postcircumfix:<{; }>(\SELF, @indices, :$exists!) { multi recurse-at-key(\SELF, \indices, 0) { False xx indices.map(*.elems).reduce(&infix:<*>) } multi recurse-at-key(\SELF, [@idx, +@indices]) { @idx.map: -> $idx { |recurse-at-key(SELF, ($idx, |@indices)) } } multi recurse-at-key(\SELF, [$idx, +@indices where *.elems > 0]) { nqp::if( nqp::not_i(SELF.EXISTS-KEY($idx)), recurse-at-key(SELF{$idx}, @indices, 0), recurse-at-key(SELF{$idx}, @indices), ) } multi recurse-at-key(\SELF, [$idx]) { SELF.EXISTS-KEY($idx) } recurse-at-key SELF, @indices } my %a = 1 => {2 => {3 => 42}}; say %a{1;2;3}:exists; say %a{-99;2;3}:exists; say %a{-99;2,3;4}:exists; say %a{1,1;2;3}:exists; say %a{1;2,2;3}:exists; say %a{1;2,2;3,3}:exists; say %a{1,1;2,2;3,3}:exists; say %a{1,1;-99,2;3,3}:exists;