Re: PDL-P: Re: Reduce [was: Re: Random items (old p5p issues)]

2000-08-05 Thread Ariel Scolnicov
Tuomas Lukka <[EMAIL PROTECTED]> writes: > On 4 Aug 2000, Ariel Scolnicov wrote: > > > Karl Glazebrook <[EMAIL PROTECTED]> writes: > > > > > OK I will raise to the bait > > > > > > I think it's a bit unfair to say that PDL people have failed to 'bite', > > > there was quite a bit of discussion

Re: PDL-P: Re: Reduce [was: Re: Random items (old p5p issues)]

2000-08-04 Thread Jeremy Howard
Karl Glazebrook wrote: > OK I will raise to the bait > > I think it's a bit unfair to say that PDL people have failed to 'bite', > there was quite a bit of discussion on our list after your post. Also > some concern about how much of perl6 is vapourware. > I do apologise, Karl. It turns out that I

Re: PDL-P: Re: Reduce [was: Re: Random items (old p5p issues)]

2000-08-04 Thread Tuomas Lukka
> > Well, first of all, > > > > 10:100, 30:200 > > > > is not the same: in Perl it comes out as > > > > 10..100, 30..200 > > > > 10, 11, ... , 100, 30, 31, .., 200 > > > > Additionally, generically it would not necessarily have to be a range of > integers. The range could be spe

Re: PDL-P: Re: Reduce [was: Re: Random items (old p5p issues)]

2000-08-04 Thread Tim Jenness
On Fri, 4 Aug 2000, Tuomas Lukka wrote: > On 4 Aug 2000, Ariel Scolnicov wrote: > > Well, first of all, > > 10:100, 30:200 > > is not the same: in Perl it comes out as > > 10..100, 30..200 > > 10, 11, ... , 100, 30, 31, .., 200 > Additionally, generically it would not ne

Re: PDL-P: Re: Reduce [was: Re: Random items (old p5p issues)]

2000-08-04 Thread Tuomas Lukka
On 4 Aug 2000, Ariel Scolnicov wrote: > Karl Glazebrook <[EMAIL PROTECTED]> writes: > > > OK I will raise to the bait > > > > I think it's a bit unfair to say that PDL people have failed to 'bite', > > there was quite a bit of discussion on our list after your post. Also > > some concern about

Re: PDL-P: Re: Reduce [was: Re: Random items (old p5p issues)]

2000-08-04 Thread Karl Glazebrook
Also on the issue of loop unrolling and efficient looping. PDL has what we call 'threading'. This allows a C-level function to specify the dimensionality of the arguments it accepts. For example a function addtoline() which hyptheticaly adds a constant to a row vector might have a 'signature'

Re: PDL-P: Re: Reduce [was: Re: Random items (old p5p issues)]

2000-08-04 Thread Ariel Scolnicov
Karl Glazebrook <[EMAIL PROTECTED]> writes: > OK I will raise to the bait > > I think it's a bit unfair to say that PDL people have failed to 'bite', > there was quite a bit of discussion on our list after your post. Also > some concern about how much of perl6 is vapourware. > > I am game to ta

Re: PDL-P: Re: Reduce [was: Re: Random items (old p5p issues)]

2000-08-04 Thread Karl Glazebrook
OK I will raise to the bait I think it's a bit unfair to say that PDL people have failed to 'bite', there was quite a bit of discussion on our list after your post. Also some concern about how much of perl6 is vapourware. I am game to take part in discussions. It has always been apparent to m

Re: Reduce [was: Re: Random items (old p5p issues)]

2000-08-04 Thread Jeremy Howard
> > 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? :-) > Yes of course. But I want to first of all see the following RF

Re: Reduce [was: Re: Random items (old p5p issues)]

2000-08-04 Thread Martyn Pearce
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

Re: Reduce [was: Re: Random items (old p5p issues)]

2000-08-03 Thread Jeremy Howard
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-i

Re: Expanding the language primitives (was: Re: Reduce [was: Re: Random items (old p5p issues)])

2000-08-03 Thread Dan Sugalski
At 09:03 PM 8/3/00 +0200, Johan Vromans wrote: >Dan Sugalski <[EMAIL PROTECTED]> writes: > > > More importantly, the more primitives that perl provides, the wilder > > and more useful things people will be able to do. > >Not quite. Its the functions that are provided that matter, not >whether they

Re: Expanding the language primitives (was: Re: Reduce [was: Re: Random items (old p5p issues)])

2000-08-03 Thread Johan Vromans
Dan Sugalski <[EMAIL PROTECTED]> writes: > More importantly, the more primitives that perl provides, the wilder > and more useful things people will be able to do. Not quite. Its the functions that are provided that matter, not whether they are primitives or not[1]. A small set of primitives wit

Re: Reduce [was: Re: Random items (old p5p issues)]

2000-08-03 Thread Tom Hughes
In article <[EMAIL PROTECTED]>, Graham Barr <[EMAIL PROTECTED]> writes: >> Note that Miranda actually calls reduce fold though - well >> actually foldl or foldr depending on which end of the list >> you start at. > > Many other have brought up this. But I ask the question "do we need two > operat

Re: Reduce [was: Re: Random items (old p5p issues)]

2000-08-03 Thread Martyn J. Pearce
Graham Barr writes: | Not at all. foldr would have to enquire the array size the iterate backwards. | reduce can do the same. Ah, well here's where the implementation counts for all. foldr probably (but not definately) would need to know the list size, but neither foldl nor foldr need to flat

Expanding the language primitives (was: Re: Reduce [was: Re: Random items (old p5p issues)])

2000-08-03 Thread Dan Sugalski
At 05:32 PM 8/2/00 +0100, Graham Barr wrote: >On Wed, Aug 02, 2000 at 12:22:10PM -0400, John Porter wrote: > > There is no limit to the funky algorithms one can come up with; > > not everyting should go in the core. > >True, but if there is a very common idiom like these that people >are constantl

Re: Reduce [was: Re: Random items (old p5p issues)]

2000-08-03 Thread John Porter
Graham Barr wrote: > > I was simply repeating a conversation. I was not implying any > name. If many other languages call it zip() then lets call it zip() No, we can't call it zip, because that's what python calls it; and that would make perl equivalent to python.* [*being facetious. hopefully

Re: Reduce [was: Re: Random items (old p5p issues)]

2000-08-03 Thread Jeremy Howard
Graham Barr said: > ... > So there probably should be an RFC to add iterators to the language and > be avaliable from perl, not just C. But I have no idea how they > should look etc. > More generally, I wonder whether there should be an RFC on the changes required to make perl a more friendly envi

Re: Reduce [was: Re: Random items (old p5p issues)]

2000-08-03 Thread Graham Barr
On Thu, Aug 03, 2000 at 06:31:38AM +, Martyn J. Pearce wrote: > And I feel that by being able to iterate over lists with map, grep, > fold[rl]/reduce{,_r}, whatever, _without pre-flattening the list_, we > could drastically increase the applicability of these constructs. Having iterators aval

Re: Reduce [was: Re: Random items (old p5p issues)]

2000-08-03 Thread Graham Barr
On Wed, Aug 02, 2000 at 07:36:09PM +0100, Tom Hughes wrote: > In message <[EMAIL PROTECTED]> > Gisle Aas <[EMAIL PROTECTED]> wrote: > > > The upcoming Python (v2.0) introduces a builtin called zip() that does > > the same thing: > > > > for a,b,c in zip(aa,bb,cc): > > ... > > >

Re: Reduce [was: Re: Random items (old p5p issues)]

2000-08-02 Thread Simon Cozens
On Wed, Aug 02, 2000 at 12:22:10PM -0400, John Porter wrote: > sub interleave(\@;\@\@\@\@\@\@\@\@) { ... > } > > sub mapf(&;\@\@\@\@\@\@\@\@\@) { ... > } > > > I guess my question is, why do these need to be builtins? sub push (\@@) { @{$_[0]} = (@{$_[0]}, @_[1..@_]); } -- Just imagine

Re: Reduce [was: Re: Random items (old p5p issues)]

2000-08-02 Thread Tom Hughes
In message <[EMAIL PROTECTED]> Gisle Aas <[EMAIL PROTECTED]> wrote: > The upcoming Python (v2.0) introduces a builtin called zip() that does > the same thing: > > for a,b,c in zip(aa,bb,cc): > ... > > There are also question on how long the resulting list should be if > @a, @b,

Re: Reduce [was: Re: Random items (old p5p issues)]

2000-08-02 Thread Glenn Linderman
Graham Barr wrote: > > The upcoming Python (v2.0) introduces a builtin called zip() that does > > the same thing: > > > > for a,b,c in zip(aa,bb,cc): > > ... > > > > There are also question on how long the resulting list should be if > > @a, @b, @c is not of the same length. I think zip(

Re: Reduce [was: Re: Random items (old p5p issues)]

2000-08-02 Thread Hildo Biersma
Tom Christiansen wrote: > > >sub mapf(&;\@\@\@\@\@\@\@\@\@) { > > Steal from lisp: > > map > maap > maaap > mapp > mappp > maappp > ... Should be feasible with an AUTOLOAD that takes a certain kind of regular expression... sub AUTOLOAD /^ma+p+$/ { } Some for the '

Re: Reduce [was: Re: Random items (old p5p issues)]

2000-08-02 Thread Graham Barr
On Wed, Aug 02, 2000 at 10:43:37AM -0600, Tom Christiansen wrote: > >sub mapf(&;\@\@\@\@\@\@\@\@\@) { > > Steal from lisp: > > map > maap > maaap > mapp > mappp > maappp dwim :) Graham.

Re: Reduce [was: Re: Random items (old p5p issues)]

2000-08-02 Thread Tom Christiansen
>sub mapf(&;\@\@\@\@\@\@\@\@\@) { Steal from lisp: map maap maaap mapp mappp maappp ... :-) --tom

Re: Reduce [was: Re: Random items (old p5p issues)]

2000-08-02 Thread Graham Barr
On Wed, Aug 02, 2000 at 12:22:10PM -0400, John Porter wrote: > I guess my question is, why do these need to be builtins? They don't. But that does not mean they should not be considered. > There is no limit to the funky algorithms one can come up with; > not everyting should go in the core. Tru

Re: Reduce [was: Re: Random items (old p5p issues)]

2000-08-02 Thread John Porter
Graham Barr wrote: > > > But then went onto interators and something like > > > > > > @list = interleave(@a,@b,@c); > > > > > > which would interleave the lists given, and > > > > > > foreach ($a,$b,$c) (interleave(@a,@b,@c)) sub interleave(\@;\@\@\@\@\@\@\@\@) { my $m = -1; for

Re: Reduce [was: Re: Random items (old p5p issues)]

2000-08-02 Thread Graham Barr
On Wed, Aug 02, 2000 at 03:40:01PM +0200, Gisle Aas wrote: > Graham Barr <[EMAIL PROTECTED]> writes: > > > On Tue, Aug 01, 2000 at 10:27:08PM +0300, Ariel Scolnicov wrote: > > >multimap operation list-of-lists # uurgh. > > > > This made me think of something else that came up in a discus

Re: Reduce [was: Re: Random items (old p5p issues)]

2000-08-02 Thread Gisle Aas
Graham Barr <[EMAIL PROTECTED]> writes: > On Tue, Aug 01, 2000 at 10:27:08PM +0300, Ariel Scolnicov wrote: > >multimap operation list-of-lists # uurgh. > > This made me think of something else that came up in a discussion with Larry > after the conference. > > The discussion started off

Re: Reduce [was: Re: Random items (old p5p issues)]

2000-08-02 Thread raptor
hi, Why not some sort of functionality like LISP/Prolog i.e. working with lists. ("a",@x,"b",%y) - the list head ("a",@x,"b",%y) # "a" head(tile("a",@x,"b",%y)) #@x head(head(tile("a",@x,"b",%y))) #$x[0] head(tile(tile("a",@x,"b",%y))) #"b" if you like it then "splice" etc... ca

Re: Reduce [was: Re: Random items (old p5p issues)]

2000-08-02 Thread Graham Barr
On Tue, Aug 01, 2000 at 10:27:08PM +0300, Ariel Scolnicov wrote: >multimap operation list-of-lists # uurgh. This made me think of something else that came up in a discussion with Larry after the conference. The discussion started off with the ability to do for ($a,$b) (@list) { ... }

Re: Reduce [was: Re: Random items (old p5p issues)]

2000-08-01 Thread Randal L. Schwartz
> "Ariel" == Ariel Scolnicov <[EMAIL PROTECTED]> writes: Ariel> reduce needs to be able to take an (optional?) "distinguished element" Ariel> to start from. Consider this: Ariel>reduce sum () == 0 Ariel>reduce times () == 1 Ariel>reduce catenate () == '' Ariel> Where do we get

Reduce [was: Re: Random items (old p5p issues)]

2000-08-01 Thread Ariel Scolnicov
[I'm splitting this up, to make it easier to know what we're talking about] Chaim Frenkel <[EMAIL PROTECTED]> writes: [...] > Reduce (e.g. $x = reduce { sum } @list; reduce needs to be able to take an (optional?) "distinguished element" to start from. Consider this: reduce