On Fri, Aug 04, 2000 at 08:16:17AM +1000, Jeremy Howard wrote:
> 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
I certainly hope so
> - Reducing to an array rather than a scalar?
<Thinks> Yes; the example of zip has previously been mentioned, and that
would.
> The first of these is pretty obvious--sometimes you want to define a mapping
> without restricting the domain.
Indeed.
> 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.
Yup.
> BTW, I'd like to see a more lightweight currying mechanism too. The
> challenge is to find a 'perlish' but not heavyweight approach...
Ah, good. I assume that having established the challenge, you'll be
rising to it? :-)
Mx.
--
See, the stars are shining bright
Everything's all right tonight
-- (Martin L. Gore, Never Let Me Down Again)