Re: right-to-left pipelines

2002-12-09 Thread Trey Harris
In a message dated Mon, 9 Dec 2002, Stéphane Payrard writes: [snipped] so it's easy to build up more complex right-to-left pipelines, like: (@foo, @bar) := part [/foo/, /bar/], sort { $^b = $^a } grep { $_ 0 }

Re: Fw: right-to-left pipelines

2002-12-09 Thread Me
'-' isn't (in my mind) a left-to-right flow/assignment operator. It's a unary operator, synonymous with sub without parens required around the argument list. given $foo - $_ { ... } given $foo sub { ... } Are all equivalent (if sub topicalizes its first parameter).

Re: right-to-left pipelines

2002-12-09 Thread Stéphane Payrard
On (09/12/02 06:00), Stéphane Payrard wrote: Date: Mon, 9 Dec 2002 06:00:40 +0100 From: Stéphane Payrard [EMAIL PROTECTED] To: Damian Conway [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] [EMAIL PROTECTED] Subject: right-to-left pipelines I would like perl6 to support left-to-right

RE: purge: opposite of grep

2002-12-09 Thread Brent Dax
It just occurred to me that Cpart is almost a specialization of Csort. Consider the results if you assign without binding: sub comparator { when /hi/ { 0 } when /lo/ { 1 } default { 2 } } @input = qw(high low hi

Re: right-to-left pipelines

2002-12-09 Thread Michael Lazzaro
On Monday, December 9, 2002, at 01:19 AM, Me wrote: So, I guess I'm suggesting a binary C- that really is a left-to-right flow/assignment op so that: @data - grep { $_ 0 } - sort { $^b = $^a } - part [/foo/, /bar/] - @foo, @bar; does what you'd expect. I like this so much

Re: right-to-left pipelines

2002-12-09 Thread Adam D. Lopresto
Looks to me like with a few appropriate methods, you have left-to-right ordering for free. (@foo, @bar) := @a . grep { $_ 0} . sort { $^b = $^b } . part [/foo/, /bar/]; Of course, that means that grep and sort and part are all methods of the Array class, so the standard way to

Re: right-to-left pipelines

2002-12-09 Thread Michael Lazzaro
On Monday, December 9, 2002, at 10:37 AM, Michael Lazzaro wrote: @source grep { /foo/ } @out;# [5] pure L-to-R Of course, we *could* define piping such that the Cgrep is not necessary: @source /foo/ @out; ... by saying that a regex or closure in a pipe DWYM. Similar to the

Re: In defense of zero-indexed arrays.

2002-12-09 Thread Mark J. Reed
On 2002-12-06 at 17:59:33, Larry Wall wrote: Now all we have to do is convince everyone that the year 1 B.C. is the same as year 0 A.D., and 2 B.C. is the same as -1 A.D., and so on. Well, since that's already true, it hopefully won't take much convincing. :) If you mean to convince the

Partially Memoized Functions

2002-12-09 Thread Smylers
Last month's discussion on memoization[*0] had the consensus that Ccached is the appropriate property name, used like so: sub square (Num $n) is cached { ... } I was wondering whether it'd be better to have this specified per Creturn rather than per Csub. That'd permit something a long the

Re: Partially Memoized Functions

2002-12-09 Thread Adam Turoff
On Mon, Dec 09, 2002 at 08:36:20PM -, Smylers wrote: I was wondering whether it'd be better to have this specified per Creturn rather than per Csub. That'd permit something a long the lines of: sub days_in_month(Str $month, Int $year) { } Perhaps there are only some

Re: right-to-left pipelines

2002-12-09 Thread Trey Harris
In a message dated Mon, 9 Dec 2002, Adam D. Lopresto writes: Looks to me like with a few appropriate methods, you have left-to-right ordering for free. (@foo, @bar) := @a . grep { $_ 0} . sort { $^b = $^b } . part [/foo/, /bar/]; Yes, exactly. Of course, that means that

Re: right-to-left pipelines

2002-12-09 Thread Michael Lazzaro
On Monday, December 9, 2002, at 08:14 AM, Adam D. Lopresto wrote: Looks to me like with a few appropriate methods, you have left-to-right ordering for free. (@foo, @bar) := @a . grep { $_ 0} . sort { $^b = $^b } . part [/foo/, /bar/]; Hmm. Does operator precedence allow that?

Re: Partially Memoized Functions

2002-12-09 Thread Austin Hastings
--- Adam Turoff [EMAIL PROTECTED] wrote: On Mon, Dec 09, 2002 at 08:36:20PM -, Smylers wrote: Perhaps there are only some edge cases which require calculation; or the function is liable to be called with many invalid input values, which can quickly be determined yield Cundef and so

Re: Partially Memoized Functions

2002-12-09 Thread Paul Johnson
On Mon, Dec 09, 2002 at 01:58:11PM -0800, Austin Hastings wrote: --- Adam Turoff [EMAIL PROTECTED] wrote: On Mon, Dec 09, 2002 at 08:36:20PM -, Smylers wrote: Anybody else like this, or are we better off leaving things as they were? I think you're trying to overoptimize

Use CPAN to help define built-ins and globals?

2002-12-09 Thread Ken Fox
Smylers wrote: Ken Fox wrote: How about formalizing global namespace pollution with something like the Usenet news group formation process? Ship Perl 6 with a very small number of global symbols and let it grow naturally. If the initial release of Perl 6 doesn't have commonly-required

Re: Partially Memoized Functions

2002-12-09 Thread Austin Hastings
--- Paul Johnson [EMAIL PROTECTED] wrote: On Mon, Dec 09, 2002 at 01:58:11PM -0800, Austin Hastings wrote: Ahh. This is better. How does one implement a more sophisticated cache management strategy? That is, what is the mechanism for manipulating the run-time system behavior of subs?

Re: 'hashkey context/Str context' (was Re: purge: opposite of grep)

2002-12-09 Thread Luke Palmer
Date: Sun, 8 Dec 2002 21:52:33 -0800 From: Dave Storrs [EMAIL PROTECTED] On Sat, Dec 07, 2002 at 01:28:41PM +1100, Damian Conway wrote: Dave Whipp wrote: I notice everyone still want Int context for eval of the block: Pease don't forget about hashes. Is there such a thing as

Re: Partially Memoized Functions

2002-12-09 Thread Paul Johnson
On Mon, Dec 09, 2002 at 02:20:01PM -0800, Austin Hastings wrote: --- Paul Johnson [EMAIL PROTECTED] wrote: On Mon, Dec 09, 2002 at 01:58:11PM -0800, Austin Hastings wrote: Ahh. This is better. How does one implement a more sophisticated cache management strategy? That is, what is

Re: Usage of \[oxdb]

2002-12-09 Thread Nicholas Clark
On Sun, Dec 08, 2002 at 03:41:22PM +1100, Damian Conway wrote: Nicholas Clark wrote: Well, I was wondering if my function returned CR, then \c[$(call_a_func())] would mean that the CR gets run thought the \c[...] conversion and a single byte (\r) is what ends up in the string. I seriously

Re: Usage of \[oxdb]

2002-12-09 Thread Luke Palmer
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm Date: Mon, 9 Dec 2002 23:43:44 + Cc: [EMAIL PROTECTED] [EMAIL PROTECTED] Content-Disposition: inline From: Nicholas Clark [EMAIL PROTECTED] X-SMTPD: qpsmtpd/0.20, http://develooper.com/code/qpsmtpd/ On Sun, Dec 08, 2002 at

Re: Partially Memoized Functions

2002-12-09 Thread Michael G Schwern
On Mon, Dec 09, 2002 at 08:36:20PM -, Smylers wrote: Last month's discussion on memoization[*0] had the consensus that Ccached is the appropriate property name, used like so: sub square (Num $n) is cached { ... } I was wondering whether it'd be better to have this specified per

Re: Usage of \[oxdb]

2002-12-09 Thread Dan Sugalski
At 5:11 PM -0700 12/9/02, Luke Palmer wrote: You must remember that the Perl 6 parser is one-pass now. It is? Are you sure? -- Dan --it's like this--- Dan Sugalski even samurai

Re: Cpart

2002-12-09 Thread Damian Conway
Michael Lazzaro wrote: I'd suggest if we could do (and ) 'piping' operators We can't have because heredocs and ..'s are already using it. Likewise we can't have because of ... See my other post on solving the left-to-right (pseudo-)problem. Damian

Re: purge: opposite of grep

2002-12-09 Thread Damian Conway
Smylers wrote: If the initial release of Perl 6 doesn't have commonly-required functions then people will write their own. People will do these in incompatible ways, ensuring that when it's determined that the language would benefit from having a particular function built in at least some

Re: purge: opposite of grep

2002-12-09 Thread Damian Conway
Ken Fox wrote: Sometimes array references behave as arrays, e.g. push $array, 1 In flattening context array refs don't flatten, only arrays. I'm not even sure that only arrays flatten either -- it might be anything that begins with @. e.g. my Point @p; ($x, $y) := @p; If the

Re: Partially Memoized Functions

2002-12-09 Thread Damian Conway
Smylers wrote: I was wondering whether it'd be better to have this specified per Creturn rather than per Csub. I doubt it. There's no performance gain from partial caching since you have to check the cache anyway to detect that a particular result isn't cached. And in those rare cases where

Re: 'hashkey context/Str context' (was Re: purge: opposite of grep)

2002-12-09 Thread Damian Conway
Dave Storrs wrote: My understanding was that in Perl6, you could use pretty much anything for a hashkey--string, number, object, whatever, and that it did not get mashed down into a string. Did I have this wrong? Not wrong. But it's not the default. The default is Str keys only. But I take

Re: purge: opposite of grep

2002-12-09 Thread Damian Conway
Brent Dax wrote: It just occurred to me that Cpart is almost a specialization of Csort. Consider the results if you assign without binding: sub comparator { when /hi/ { 0 } when /lo/ { 1 } default { 2 } } @input = qw(high low hi lo glurgl); @out1 = part comparator @input; @out2

Re: Usage of \[oxdb]

2002-12-09 Thread Joseph F. Ryan
Luke Palmer wrote: Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm Date: Mon, 9 Dec 2002 23:43:44 + Cc: [EMAIL PROTECTED] [EMAIL PROTECTED] Content-Disposition: inline From: Nicholas Clark [EMAIL PROTECTED] X-SMTPD: qpsmtpd/0.20, http://develooper.com/code/qpsmtpd/ On Sun, Dec 08,

Re: right-to-left pipelines

2002-12-09 Thread Damian Conway
Dave Whipp wrote: I like the intent, but I'm not sure about the syntax -- nor the statement about precidence: seems to me that the pipe operator needs a very low precidence, not very high. An existing convention for low precidence versions of operators is to use an alphabetic name (e.g. || vs

Re: right-to-left pipelines

2002-12-09 Thread Damian Conway
Adam D. Lopresto wrote: Looks to me like with a few appropriate methods, you have left-to-right ordering for free. (@foo, @bar) := @a . grep { $_ 0} . sort { $^b = $^b } . part [/foo/, /bar/]; Yes indeed. Of course, that means that grep and sort and part are all methods of

Re: Usage of \[oxdb]

2002-12-09 Thread Joseph F. Ryan
Dan Sugalski wrote: At 5:11 PM -0700 12/9/02, Luke Palmer wrote: You must remember that the Perl 6 parser is one-pass now. It is? Are you sure? It should be; the raw parsed data might be treated with regular expressions in the parse-tree processing stage, but that shouldn't count as a

Re: Usage of \[oxdb]

2002-12-09 Thread Dan Sugalski
At 10:16 PM -0500 12/9/02, Joseph F. Ryan wrote: Dan Sugalski wrote: At 5:11 PM -0700 12/9/02, Luke Palmer wrote: You must remember that the Perl 6 parser is one-pass now. It is? Are you sure? It should be; Doesn't mean it will be. And should is an awfully strong word... --

Re: Usage of \[oxdb]

2002-12-09 Thread Joseph F. Ryan
Dan Sugalski wrote: At 10:16 PM -0500 12/9/02, Joseph F. Ryan wrote: Dan Sugalski wrote: At 5:11 PM -0700 12/9/02, Luke Palmer wrote: You must remember that the Perl 6 parser is one-pass now. It is? Are you sure? It should be; Doesn't mean it will be. And should is an awfully