Lets say I want to find the 5th smallest element in an array. I might write:

  @array.sort.[4];

How does the implementation of the sort function know that I just want to 5th item (and thus choose an appropriate optimization)? Obviously the function could be told that it's caller wants 5 values in list context, but is there a way to get more info than that?

Reply via email to