original_string: public function partitionBy($key) {
          $partition = array();
          foreach ($this->elements as $element) {
              $newEquivalenceClass = true;
              for ($i = 0; $i < count($partition); $i++) // partition[$i] is an equivalence class
                  // an equivalence class is guaranteed to be non-empty
                  if (call_user_func(array($element, $key), $partition[$i][0])) {
                      $partition[$i][] = $element;
                      $newEquivalenceClass = false;
                  }
              if ($newEquivalenceClass)
                  $partition[] = array($element);
          }
          return $partition;
      }
code: public function partitionBy($key) {
          $partition = array();
          foreach ($this->elements as $element) {
              $newEquivalenceClass = true;
              for ($i = 0; $i < count($partition); $i++) // partition[$i] is an equivalence class
                  // an equivalence class is guaranteed to be non-empty
                  if (call_user_func(array($element, $key), $partition[$i][0])) {
                      $partition[$i][] = $element;
                      $newEquivalenceClass = false;
                  }
              if ($newEquivalenceClass)
                  $partition[] = array($element);
          }
          return $partition;
      }
code_tokens: public function partitionBy ( $ key ) { $ partition = array ( ) ; foreach ( $ this -> elements as $ element ) { $ newEquivalenceClass = true ; for ( $ i = 0 ; $ i < count ( $ partition ) ; $ i ++ ) // partition[$i] is an equivalence class // an equivalence class is guaranteed to be non-empty if ( call_user_func ( array ( $ element , $ key ) , $ partition [ $ i ] [ 0 ] ) ) { $ partition [ $ i ] [ ] = $ element ; $ newEquivalenceClass = false ; } if ( $ newEquivalenceClass ) $ partition [ ] = array ( $ element ) ; } return $ partition ; }
docstring: Partitions the elements using an equivalence relation.
  @param callable $key a binary relation on the elements
  @return array[]
docstring_tokens: Partitions the elements using an equivalence relation .