Re: Declarations of constants

2005-05-31 Thread Adam Kennedy
Ingo Blechschmidt wrote: Hi, # Way 1 my $MEANING_OF_LIFE is constant = 42; Forgive my ignorance here, but for all of these different ways of doing constants, will they all optimize (including partial evaluation/currying) at compile/build/init/run-time? my $gravity is constant = 10; #

Re: Declarations of constants

2005-05-31 Thread Simon Cozens
[EMAIL PROTECTED] (Adam Kennedy) writes: Forgive my ignorance here, but for all of these different ways of doing constants, will they all optimize (including partial evaluation/currying) at compile/build/init/run-time? Gosh, I hope not. my $gravity is constant = 10; # One significant figure

date and time formatting

2005-05-31 Thread Nathan Gray
As I am interested in human-readable dates and times, and having found no conclusive discussion on time formatting, I make my recommendation for a syntax (to start discussion, and allow for date formatting to be implemented in pugs): I would like for time() to return an object, which in numeric

Re: date and time formatting

2005-05-31 Thread Rob Kinyon
On 5/31/05, Nathan Gray [EMAIL PROTECTED] wrote: As I am interested in human-readable dates and times, and having found no conclusive discussion on time formatting, I make my recommendation for a syntax (to start discussion, and allow for date formatting to be implemented in pugs): What's

Re: date and time formatting

2005-05-31 Thread Patrick R. Michaud
On Tue, May 31, 2005 at 09:23:11AM -0400, Nathan Gray wrote: As I am interested in human-readable dates and times, and having found no conclusive discussion on time formatting, I make my recommendation for a syntax (to start discussion, and allow for date formatting to be implemented in pugs):

Re: date and time formatting

2005-05-31 Thread David Storrs
On May 31, 2005, at 9:51 AM, Rob Kinyon wrote: On 5/31/05, Nathan Gray [EMAIL PROTECTED] wrote: As I am interested in human-readable dates and times, and having found no conclusive discussion on time formatting, I make my recommendation for a syntax (to start discussion, and allow for date

Re: comprehensive list of perl6 rule tokens

2005-05-31 Thread Patrick R. Michaud
On Sun, May 29, 2005 at 12:52:25PM -0400, Jeff 'japhy' Pinyan wrote: I'm curious if commit and cut capture anything. They don't start with '?', so following the guidelines, it would appear they capture, but that doesn't make sense. Should they be written as ?commit and ?cut, or is the

Re: date and time formatting

2005-05-31 Thread Rob Kinyon
What's wrong with porting DateTime? It's back to the old question of what's in core? Are dates and times something that are used in such a large proportion of programs that they deserve to be shipped in the basic grammar? Or perhaps in the basic set of packages? Perl 5 has an entire

Re: date and time formatting

2005-05-31 Thread Rod Adams
Nathan Gray wrote: possibly as an strftime() pattern. Can we please make sure that strftime() is _not_ OS dependent like the POSIX version is now? -- Rod Adams

Re: date and time formatting

2005-05-31 Thread David Storrs
On May 31, 2005, at 1:16 PM, Rob Kinyon wrote: What's wrong with porting DateTime? It's back to the old question of what's in core? Are dates and times something that are used in such a large proportion of programs that they deserve to be shipped in the basic grammar? Or perhaps in the

Re: date and time formatting

2005-05-31 Thread David Storrs
On May 31, 2005, at 2:22 PM, Rob Kinyon wrote: my ($launch_date = now() + 6 weeks) but time(9am); Sure. $launch_date is of type DateTime. It will numify to the seconds-since-the-epoch, stringify to some date string, and provide all the neat-o-keen methods you want it to have. Works for

Re: date and time formatting

2005-05-31 Thread Jonathan Scott Duff
On Tue, May 31, 2005 at 01:11:21PM -0500, Rod Adams wrote: Nathan Gray wrote: possibly as an strftime() pattern. Can we please make sure that strftime() is _not_ OS dependent like the POSIX version is now? I don't mind an OS dependent strftime() as long as we have some formatter that is OS

Re: reduce metaoperator on an empty list

2005-05-31 Thread Larry Wall
On Mon, May 23, 2005 at 08:54:19PM +, [EMAIL PROTECTED] wrote: : : There are actuall two usefull definition for %. The first which Ada calls 'mod' always returns a value 0=XN and yes it has no working value that is an identity. The other which Ada calls 'rem' defined as follows: : :

Re: comprehensive list of perl6 rule tokens

2005-05-31 Thread Larry Wall
On Thu, May 26, 2005 at 11:19:42AM -0500, Patrick R. Michaud wrote: : Do we still have the rule syntax, or was that abandoned in : favor of ?rule ? (I know there are still some remnants of ... : in S05 and A05, but I'm not sure they're intentional.) It's gone, though we're reserving it for

Re: Sub call resolution

2005-05-31 Thread Larry Wall
On Mon, May 30, 2005 at 08:39:57AM +, Luke Palmer wrote: : Okay, I'd like to set myself straight. Sanity check: : : bar($foo, $baz); # looks for subs (lexical then package), and : falls back to MMD Er, no. : $foo.bar($baz);# looks in ref($foo), then falls back to MMD : : If

Re: mod/div

2005-05-31 Thread Mark Reed
On 2005-05-30 05:15, TSa (Thomas Sandlaß) [EMAIL PROTECTED] wrote: Mark Reed wrote: I would really like to see ($x div $y) be (floor($x/$y)) That is: floor( 8 / (-3) ) == floor( -2. ) == -3 Or do you want -2? and ($x mod $y) be ($x - $x div $y). Hmm, since 8 - (-3) == 11 this

Re: comprehensive list of perl6 rule tokens

2005-05-31 Thread Patrick R. Michaud
On Tue, May 31, 2005 at 01:20:57PM -0700, Larry Wall wrote: On Thu, May 26, 2005 at 11:19:42AM -0500, Patrick R. Michaud wrote: : Do we still have the rule syntax, or was that abandoned in : favor of ?rule ? (I know there are still some remnants of ... : in S05 and A05, but I'm not sure

Re: (1,(2,3),4)[2]

2005-05-31 Thread Larry Wall
On Wed, May 25, 2005 at 07:07:02PM -0400, Uri Guttman wrote: : the only advantage in the above case is the different prececences of = : and == which allows dropping of parens with the latter. i don't : consider that so important a win as to be used often. and they are at : equal huffman levels as

Re: (1,(2,3),4)[2]

2005-05-31 Thread Larry Wall
On Tue, May 31, 2005 at 03:42:42PM -0700, Larry Wall wrote: : On Wed, May 25, 2005 at 07:07:02PM -0400, Uri Guttman wrote: : : the only advantage in the above case is the different prececences of = : : and == which allows dropping of parens with the latter. i don't : : consider that so important a

Re: Unicode Operators cheatsheet, please!

2005-05-31 Thread Sam Vilain
Rob Kinyon wrote: I would love to see a document (one per editor) that describes the Unicode characters in use and how to make them. The Set implementation in Pugs uses (at last count) 20 different Unicode characters as operators. I have updated the unicode quickref, and started a Perlmonks

Re: comprehensive list of perl6 rule tokens

2005-05-31 Thread Patrick R. Michaud
On Thu, May 26, 2005 at 11:19:42AM -0500, Patrick R. Michaud wrote: $rule N indirect rule ::$rulename N indirect symbolic rule @rulesN like '@rules' %rulesN like '%rules' { code } N code produces a

Re: Default invocant of methods

2005-05-31 Thread Larry Wall
On Fri, May 27, 2005 at 10:59:25PM +0200, Ingo Blechschmidt wrote: : Hi, : : what is the default invocant of methods? : : method blarb ($normal_param) {...} : # Same as : method blarb (Class | ::?CLASS $invocant: $normal_param) {...} : # or : method blarb (::?CLASS $invocant:

returns and context

2005-05-31 Thread Gaal Yahas
How do I specify the signature of a context-sensitive function? sub foo() returns (what?) { return want ~~ Scalar ?? cheap_integer_result :: List_of_Sheep; } If it were two subs, one would is returns Int and the other List of Sheep. The draft S29 uses things like Int|List to

Re: construction clarification

2005-05-31 Thread Damian Conway
Carl Franks wrote: I have a class that normally takes a list of named arguments. I also want to be able to handle a single argument. class Foo { multi method new (Class $class: Str $date) { return $class.bless(date = $date); } submethod BUILD ($.date, $.time, $.offset) { #

Re: Declarations of constants

2005-05-31 Thread Damian Conway
Adam Kennedy wrote: Forgive my ignorance here, but for all of these different ways of doing constants, will they all optimize (including partial evaluation/currying) at compile/build/init/run-time? my $gravity is constant = 10; # One significant figure sub time_to_ground ($height, $accel) {

Re: returns and context

2005-05-31 Thread Rod Adams
Gaal Yahas wrote: How do I specify the signature of a context-sensitive function? sub foo() returns (what?) { return want ~~ Scalar ?? cheap_integer_result :: List_of_Sheep; } If it were two subs, one would is returns Int and the other List of Sheep. The draft S29 uses things

Re: reduce metaoperator on an empty list

2005-05-31 Thread Damian Conway
All this discussion of identity defaults for reductions has been very interesting and enlightening. But it seems to me that the simplest correct behaviour for reductions is: 2+ args: interpolate specified operator 1 arg: return that arg 0 args: fail (i.e. thrown or unthrown

Re: reduce metaoperator on an empty list

2005-05-31 Thread Dave Whipp
Damian Conway wrote: 0 args: fail (i.e. thrown or unthrown exception depending on use fatal) ... $sum = ([+] @values err 0); $prod = ([*] @values err 1); $prob = ([*] @probs err 0); Just wanted to check, if I've said use fatal: will that err 0 DWIM, or will the

Re: reduce metaoperator on an empty list

2005-05-31 Thread Damian Conway
Dave Whipp wrote: Damian Conway wrote: 0 args: fail (i.e. thrown or unthrown exception depending on use fatal) ... $sum = ([+] @values err 0); $prod = ([*] @values err 1); $prob = ([*] @probs err 0); Just wanted to check, if I've said use fatal: will that err 0

Re: construction clarification

2005-05-31 Thread Larry Wall
On Mon, May 30, 2005 at 05:00:26PM +0100, Carl Franks wrote: : I have a class that normally takes a list of named arguments. : I also want to be able to handle a single argument. : : class Foo { : multi method new (Class $class: Str $date) { : return $class.bless(date = $date); : } : :

Re: reduce metaoperator on an empty list

2005-05-31 Thread Dave Whipp
Damian Conway wrote: And what you'd need to write would be: $sum = (try{ [+] @values } err 0); The err ... idiom seems too useful to have it break in this case. Afterall, the purpose of err 0 is to tell the stupid computer that I know what to do with the empty-array scenario. Feels

Re: reduce metaoperator on an empty list

2005-05-31 Thread Damian Conway
Dave Whipp wrote: Damian Conway wrote: And what you'd need to write would be: $sum = (try{ [+] @values } err 0); The err ... idiom seems too useful to have it break in this case. Afterall, the purpose of err 0 is to tell the stupid computer that I know what to do with the

Re: reduce metaoperator on an empty list

2005-05-31 Thread Juerd
Damian Conway skribis 2005-06-01 10:44 (+1000): 2+ args: interpolate specified operator 1 arg: return that arg 0 args: fail (i.e. thrown or unthrown exception depending on use fatal) Following this logic, does join( , @foo) with [EMAIL PROTECTED] being 0 fail too? I dislike

Re: reduce metaoperator on an empty list

2005-05-31 Thread Damian Conway
Juerd asked: 2+ args: interpolate specified operator 1 arg: return that arg 0 args: fail (i.e. thrown or unthrown exception depending on use fatal) Following this logic, does join( , @foo) with [EMAIL PROTECTED] being 0 fail too? No. It returns empty string. You could think of

Perl 6 Summary for 2005-05-24 through 2005-05-31

2005-05-31 Thread Matt Fowles
Perl 6 Summary for 2005-05-24 through 2005-05-31 All~ Welcome to another Perl 6 summary, brought to you by Aliya's new friends, Masha Nannifer and Philippe, and my own secret running joke. Without further ado, I bring you Perl 6 Compiler. Perl 6 Compiler method chaining

RE: reduce metaoperator on an empty list

2005-05-31 Thread Joe Gottman
-Original Message- From: Damian Conway [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 31, 2005 11:14 PM To: perl6-language@perl.org Subject: Re: reduce metaoperator on an empty list Juerd asked: 2+ args: interpolate specified operator 1 arg: return that arg 0

Re: date and time formatting

2005-05-31 Thread Sam Vilain
Rob Kinyon wrote: What I'm trying to get at isn't that DateTime's API should be preserved. I'm saying that the concept of DateTime should be ported. Core or not core - it doesn't matter. When use'd (or installed), it should override now() (and anyone else we can think of) to return an object

Re: returns and context

2005-05-31 Thread Sam Vilain
Rod Adams wrote: How do I specify the signature of a context-sensitive function? sub foo() returns (what?) { return want ~~ Scalar ?? cheap_integer_result :: List_of_Sheep; } I suspect a typed junction would look like : Junction of Int|Str. Not quite. AIUI that means a

Re: Perl 6 Summary... p6rules

2005-05-31 Thread Dino Morelli
Thank you for the summary, Matt I have a correction, though: subrules tests Dino Morelli provided a patch adding tests for subrules to PGE. Warnock applies. http://xrl.us/f955 This and my other two patches to p6rules tests (RT #35950, 35971, 35994) have not yet been applied.

Re: returns and context

2005-05-31 Thread Rod Adams
Sam Vilain wrote: Rod Adams wrote: How do I specify the signature of a context-sensitive function? sub foo() returns (what?) { return want ~~ Scalar ?? cheap_integer_result :: List_of_Sheep; } I suspect a typed junction would look like : Junction of Int|Str. Not quite.

Re: reduce metaoperator on an empty list

2005-05-31 Thread Damian Conway
Joe Gottman pointed out: No. It returns empty string. You could think of Cjoin as being implemented: sub join (Str $sep, [EMAIL PROTECTED]) { reduce { $^a ~ $sep ~ $^b } , @list } If this were the case, then join '~', 'a', 'b', 'c' would equal '~a~b~c' instead of

Re: Perl 6 Summary... p6rules

2005-05-31 Thread Patrick R. Michaud
On Tue, May 31, 2005 at 11:58:12PM -0400, Dino Morelli wrote: Thank you for the summary, Matt I have a correction, though: subrules tests Dino Morelli provided a patch adding tests for subrules to PGE. Warnock applies. http://xrl.us/f955 This and my other two patches