@function __create-compounder-function($string) {
  $callback: __this("callback");
  $index: 1;
  $list: __words($string);
  $length: length($list);
  $result: "";

  @while ($index <= $length) {
    $result: __exec($callback, $result, nth($list, $index), $index);
    $index: $index + 1;
  }

  @return $result;
}

@function __create-compounder($callback) {
  $_: __scope(
    (
      "callback": $callback
    )
  );
  $scoped-function: __bind("__create-compounder-function");
  $_: __scope(false);

  @return $scoped-function;
}
