Martyn J. Pearce wrote:
> <...> what I would like to discuss adding to the language is
>
> 1) a means to signal an early exit to the iterator,
> 2) a means to tell we're at the end of a list without having to
> evaluate the list length as we start
> 3) a much more lightweight, and language built-in, mechanism for
> currying these functions.

Would the changes you're discussing support:
- Infinite lists
- Reducing to an array rather than a scalar?

The first of these is pretty obvious--sometimes you want to define a mapping
without restricting the domain.

The second is about writing something like:
  @a = sumover(@b[$index::j]
to get column sums. $index::j is in this case an iterator defined as
operating over the second index of an array. Of course you can always do
this with a loop, but to me the whole point of adding iterators, matrix ops,
and reduce/fold is that you can write your code the way a mathematician
writes a function. Having to put explicit loops in is a bit messy.

I'm sorry if this is obvious. I can see the pieces of perl that are missing
in terms of what I'd like to do with it, but I can't yet see how specific
proposed changes to the language fit together to make these things possible.

BTW, I'd like to see a more lightweight currying mechanism too. The
challenge is to find a 'perlish' but not heavyweight approach...


Reply via email to