Re: New S29 draft up

2005-04-02 Thread Larry Wall
On Sat, Apr 02, 2005 at 11:27:09PM +0300, wolverian wrote: : On Mon, Mar 21, 2005 at 03:31:53PM +0100, Juerd wrote: : > In fact, won't things be much easier if shift and pop workend on strings : > as well as on arrays? Now that we have multis, this should be easy to : > do. : : How about defining

Re: New S29 draft up

2005-04-02 Thread wolverian
On Mon, Mar 21, 2005 at 03:31:53PM +0100, Juerd wrote: > In fact, won't things be much easier if shift and pop workend on strings > as well as on arrays? Now that we have multis, this should be easy to > do. How about defining String is Array? I don't know if I would like that, but it's an idea.

Re: New S29 draft up

2005-03-23 Thread Thomas Sandlaß
HaloO Larry, you wrote: : class Str[ ::T does StringNumification ] : {...} And then, based only on what you've written there, we need to teach people all about classes, parameterized types, representational types, constraints, formal type parameters, and roles before they can begin to write the rad

Re: New S29 draft up

2005-03-23 Thread Larry Wall
On Wed, Mar 23, 2005 at 07:33:43PM +0100, Thomas Sandlaß wrote: : Larry Wall wrote: : >So we should probably : >have a generalized radix_to_dec($radix,$input) function out there : >somewhere instead. : : Why not shift it onto the type system: : : my Int $i = $input as Str[$radix] as Int; : : A b

Re: New S29 draft up

2005-03-23 Thread Thomas Sandlaß
Larry Wall wrote: So we should probably have a generalized radix_to_dec($radix,$input) function out there somewhere instead. Why not shift it onto the type system: my Int $i = $input as Str[$radix] as Int; A bit lengthy but quite clear. And easy to extend e.g. to roman numerals: say "VII" as Str[Ro

Re: New S29 draft up

2005-03-23 Thread Aaron Sherman
On Wed, 2005-03-23 at 12:58, Larry Wall wrote: > :2<1000_> > :10<1_000_000> Two things: 1. Just a note that Pugs doesn't yet do _ in numbers, but should 2. I'd really like to see a warning on non-standard _ breaks, e.g; 1_00_000 should issue a warning. > Interestingly,

Re: New S29 draft up

2005-03-23 Thread Larry Wall
On Wed, Mar 23, 2005 at 03:28:31PM +, Peter Haworth wrote: : On Mon, 21 Mar 2005 08:41:27 -0800, Larry Wall wrote: : > Okay, I've come around to liking it, but I think we have to say that : > 0x, 0d, 0o, 0b, and whatever else we come up with are just setting : > the default radix. If a string c

Re: New S29 draft up

2005-03-23 Thread Peter Haworth
On Mon, 21 Mar 2005 08:41:27 -0800, Larry Wall wrote: > Okay, I've come around to liking it, but I think we have to say that > 0x, 0d, 0o, 0b, and whatever else we come up with are just setting > the default radix. If a string comes in with an explicit 0x, 0d, 0o, > or 0b, we believe that in prefer

Re: New S29 draft up

2005-03-21 Thread John Macdonald
On Mon, Mar 21, 2005 at 03:31:53PM +0100, Juerd wrote: > [...] (The symmetry is slightly broken, though, because if you push > "foo" once, you have to pop three times to get it back. I don't think > this is a problem.)) That's not a new break to the symmetry of push and pop: @b = (1,2,3);

Re: New S29 draft up

2005-03-21 Thread Larry Wall
On Sun, Mar 20, 2005 at 08:54:54PM -0600, Rod Adams wrote: Okay, I've come around to liking it, but I think we have to say that 0x, 0d, 0o, 0b, and whatever else we come up with are just setting the default radix. If a string comes in with an explicit 0x, 0d, 0o, or 0b, we believe that in preferen

Re: eval (was Re: New S29 draft up)

2005-03-21 Thread Juerd
Paul Seamons skribis 2005-03-18 9:46 (-0700): > eval slurp "foo"; That requires foo to have an #line directive (or whatever its Perl 6 equivalent will be) in order to be useful when debugging. See also http://tnx.nl/include (I want Perl 6 to have this function that evals a file such that in

Re: New S29 draft up

2005-03-21 Thread Juerd
John Macdonald skribis 2005-03-18 12:00 (-0500): > I've had times when I wanted to be able to use chop at either > end of a string. In fact, won't things be much easier if shift and pop workend on strings as well as on arrays? Now that we have multis, this should be easy to do. (For symmetry, thi

Re: eval (was Re: New S29 draft up)

2005-03-20 Thread Rod Adams
Larry Wall wrote: On Fri, Mar 18, 2005 at 10:28:18AM -0500, Aaron Sherman wrote: : Thus: : : eval read :file("foo"); : : There you have it. The problem being that it will now report errors in some random temporary string rather than at some line number in a file. Not good. Orthogonality strike

Re: New S29 draft up

2005-03-20 Thread Rod Adams
Luke Palmer wrote: Matt Diephouse writes: Juerd <[EMAIL PROTECTED]> wrote: Matt Diephouse skribis 2005-03-18 13:35 (-0500): Too bad sub names can't start with numbers: 0x $hex; # hex $hex But they can, if you call them prefix operators instead of subs. See also -e and alike

Re: New S29 draft up

2005-03-20 Thread Luke Palmer
Matt Diephouse writes: > Juerd <[EMAIL PROTECTED]> wrote: > > Matt Diephouse skribis 2005-03-18 13:35 (-0500): > > > Too bad sub names can't start with numbers: > > > 0x $hex; # hex $hex > > > > But they can, if you call them prefix operators instead of subs. See > > also -e and alike operators,

Re: New S29 draft up

2005-03-20 Thread Matt Diephouse
Juerd <[EMAIL PROTECTED]> wrote: > Matt Diephouse skribis 2005-03-18 13:35 (-0500): > > Too bad sub names can't start with numbers: > > 0x $hex; # hex $hex > > But they can, if you call them prefix operators instead of subs. See > also -e and alike operators, which start with a character that is

Re: New S29 draft up

2005-03-20 Thread Juerd
Matt Diephouse skribis 2005-03-18 13:35 (-0500): > > +"0x$_" # hex > > +"0o$_" # oct > > +"0b$_" # bin (does not exist in Perl 5) > Too bad sub names can't start with numbers: > 0x $hex; # hex $hex But they can, if you call them prefix operators instead of subs. See also -e and alike operator

Re: eval (was Re: New S29 draft up)

2005-03-18 Thread James Mastros
Larry Wall wrote: On Fri, Mar 18, 2005 at 10:28:18AM -0500, Aaron Sherman wrote: : Thus: : : eval read :file("foo"); : : There you have it. The problem being that it will now report errors in some random temporary string rather than at some line number in a file. Not good. Orthogonality strike

Re: eval (was Re: New S29 draft up)

2005-03-18 Thread Dave Whipp
Larry Wall wrote: On Fri, Mar 18, 2005 at 10:28:18AM -0500, Aaron Sherman wrote: : Thus: : : eval read :file("foo"); : : There you have it. The problem being that it will now report errors in some random temporary string rather than at some line number in a file. Not good. Orthogonality strike

Re: New S29 draft up

2005-03-18 Thread Rod Adams
John Macdonald wrote: On Thu, Mar 17, 2005 at 09:18:45PM -0800, Larry Wall wrote: On Thu, Mar 17, 2005 at 06:11:09PM -0500, Aaron Sherman wrote: : Chop removes the last character from a string. Is that no longer useful, : or has chomp simply replaced its most common usage? I expect chop still ha

Re: New S29 draft up

2005-03-18 Thread Matt Diephouse
On Fri, 18 Mar 2005 11:27:56 +0100, Juerd <[EMAIL PROTECTED]> wrote: > Larry Wall skribis 2005-03-17 21:06 (-0800): > > oct and hex are arguably misnamed, since most functions are named by > > what they produce, not by what they take as input. I don't know what > > the replacement should be, thoug

Re: New S29 draft up

2005-03-18 Thread John Macdonald
On Fri, Mar 18, 2005 at 09:24:43AM -0800, Larry Wall wrote: > [...] And if > chomp is chomping and returning the terminator as determined by the > line input layer, then chimp would have to return the actual line and > leave just the terminator. :-) With the mnemonic "Don't monkey around with my

Re: New S29 draft up

2005-03-18 Thread Larry Wall
On Fri, Mar 18, 2005 at 12:00:32PM -0500, John Macdonald wrote: : Generally when I do this I am not only deleting the character : from the string, but also moving it to another scaler to use; : so substr isn't a simple replacement because you'd have to : use it twice. Well, not lately. There's

Re: New S29 draft up

2005-03-18 Thread Larry Wall
On Fri, Mar 18, 2005 at 08:21:07AM -0500, John Siracusa wrote: : On 3/18/05 12:18 AM, Larry Wall wrote: : > Autochomping is one of the motivations for switching from "while" to : > "for" for the normal line input method, since "while" might think a : > blank line is false, while "for" only cares wh

Re: Bitops (was Re: New S29 draft up)

2005-03-18 Thread Larry Wall
On Fri, Mar 18, 2005 at 05:01:50AM -0600, Rod Adams wrote: : I'll try to come up with something decent, if no one beats me to it. : Sadly, the C style hex2int, oct2int might be the least confusing, but : heinously ugly. Yes, though there are two difficulties right there in the names: hardwiring

Re: eval (was Re: New S29 draft up)

2005-03-18 Thread Larry Wall
On Fri, Mar 18, 2005 at 10:28:18AM -0500, Aaron Sherman wrote: : Thus: : : eval read :file("foo"); : : There you have it. The problem being that it will now report errors in some random temporary string rather than at some line number in a file. Not good. Orthogonality strikes again. Lar

Re: eval (was Re: New S29 draft up)

2005-03-18 Thread Paul Seamons
> eval read :file("foo") How about: eval slurp "foo"; Paul Seamons

Re: New S29 draft up

2005-03-18 Thread John Macdonald
On Thu, Mar 17, 2005 at 09:18:45PM -0800, Larry Wall wrote: > On Thu, Mar 17, 2005 at 06:11:09PM -0500, Aaron Sherman wrote: > : Chop removes the last character from a string. Is that no longer useful, > : or has chomp simply replaced its most common usage? > > I expect chop still has its uses. I

Re: eval (was Re: New S29 draft up)

2005-03-18 Thread Aaron Sherman
On Fri, 2005-03-18 at 10:28, Aaron Sherman wrote: > On Fri, 2005-03-18 at 05:42, Rod Adams wrote: > > > Hmm. maybe we just need a function that loads an entire file and returns > > a string of it, then feeds that to eval. > > Well, I wasn't getting into the IO stuff, but since you said it, this

Re: eval (was Re: New S29 draft up)

2005-03-18 Thread Aaron Sherman
On Fri, 2005-03-18 at 05:42, Rod Adams wrote: > Hmm. maybe we just need a function that loads an entire file and returns > a string of it, then feeds that to eval. Well, I wasn't getting into the IO stuff, but since you said it, this crosses a line with many related IO operations. I would call t

Re: New S29 draft up

2005-03-18 Thread John Siracusa
On 3/18/05 12:18 AM, Larry Wall wrote: > Autochomping is one of the motivations for switching from "while" to > "for" for the normal line input method, since "while" might think a > blank line is false, while "for" only cares whether the next value > is defined. Speaking of which (ha), does that m

Re: New S29 draft up

2005-03-18 Thread Uri Guttman
> "MD" == Matt Diephouse <[EMAIL PROTECTED]> writes: MD> Uri Guttman <[EMAIL PROTECTED]> wrote: >> > "LW" == Larry Wall <[EMAIL PROTECTED]> writes: LW> oct and hex are arguably misnamed, since most functions are named by LW> what they produce, not by what they take as input. I don

Re: New S29 draft up

2005-03-18 Thread Thomas Sandlaß
Juerd wrote: +"0x$_" # hex +"0o$_" # oct +"0b$_" # bin (does not exist in Perl 5) This does require that strings numify the same way literals do, but I think that's a sane approach anyhow. Now that leading 0 no longer means the number is octal, I can't think of a good reason to keep the contrast

Bitops (was Re: New S29 draft up)

2005-03-18 Thread Rod Adams
Larry Wall wrote: On Thu, Mar 17, 2005 at 10:31:07PM -0600, Rod Adams wrote: : Aaron Sherman wrote: : >>Methods on numeric values (should be defined as pseudo-methods on : >>unboxed numbers): : >> : >> chr : >> hex : >>oct : >> : >> : > : >Sigh... well, now I know what Ctrl-Return do

eval (was Re: New S29 draft up)

2005-03-18 Thread Rod Adams
Brent 'Dax' Royal-Gordon wrote: Larry Wall <[EMAIL PROTECTED]> wrote: : C I'll tackle at the same time as C. It's likely : staying in some form. I use it from time to time when I'm patching : together several automation scripts. (Remember that Perl gets used for : the quick and dirty as well as

Re: New S29 draft up

2005-03-18 Thread Juerd
Larry Wall skribis 2005-03-17 21:06 (-0800): > oct and hex are arguably misnamed, since most functions are named by > what they produce, not by what they take as input. I don't know what > the replacement should be, though. Maybe it's not worth fixing. +"0x$_" # hex +"0o$_" # oct +"0b$_" # bi

Perl6 Rule library (was: New S29 draft up)

2005-03-18 Thread Ashley Winters
On Fri, 18 Mar 2005 00:20:57 -0500, Uri Guttman <[EMAIL PROTECTED]> wrote: > > "LW" == Larry Wall <[EMAIL PROTECTED]> writes: > > LW> oct and hex are arguably misnamed, since most functions are named by > LW> what they produce, not by what they take as input. I don't know what > LW> the

Re: New S29 draft up

2005-03-17 Thread Matt Diephouse
Uri Guttman <[EMAIL PROTECTED]> wrote: > > "LW" == Larry Wall <[EMAIL PROTECTED]> writes: > LW> oct and hex are arguably misnamed, since most functions are named by > LW> what they produce, not by what they take as input. I don't know what > LW> the replacement should be, though. Maybe

Re: New S29 draft up

2005-03-17 Thread Brent 'Dax' Royal-Gordon
Larry Wall <[EMAIL PROTECTED]> wrote: > : C I'll tackle at the same time as C. It's likely > : staying in some form. I use it from time to time when I'm patching > : together several automation scripts. (Remember that Perl gets used for > : the quick and dirty as well as the big and elegant.) > >

Re: New S29 draft up

2005-03-17 Thread Uri Guttman
> "LW" == Larry Wall <[EMAIL PROTECTED]> writes: LW> oct and hex are arguably misnamed, since most functions are named by LW> what they produce, not by what they take as input. I don't know what LW> the replacement should be, though. Maybe it's not worth fixing. from_oct, from_hex whi

Re: New S29 draft up

2005-03-17 Thread Larry Wall
On Thu, Mar 17, 2005 at 06:11:09PM -0500, Aaron Sherman wrote: : =head2 Obsolete : : =item chop : : Chop removes the last character from a string. Is that no longer useful, : or has chomp simply replaced its most common usage? I expect chop still has its uses. Also, since $/ is

Re: New S29 draft up

2005-03-17 Thread Larry Wall
On Thu, Mar 17, 2005 at 10:31:07PM -0600, Rod Adams wrote: : Aaron Sherman wrote: : >>Methods on numeric values (should be defined as pseudo-methods on : >>unboxed numbers): : >> : >> chr : >> hex : >>oct : >> : >> : > : >Sigh... well, now I know what Ctrl-Return does in Evolution :-

Re: New S29 draft up

2005-03-17 Thread Rod Adams
Aaron Sherman wrote: On Thu, 2005-03-17 at 20:47 -0500, Aaron Sherman wrote: Methods on numeric values (should be defined as pseudo-methods on unboxed numbers): chr hex oct Sigh... well, now I know what Ctrl-Return does in Evolution :-/ Ok, so what I was getting at was that th

Re: New S29 draft up

2005-03-17 Thread Rod Adams
Aaron Sherman wrote: On Wed, 2005-03-16 at 02:18 -0600, Rod Adams wrote: I just posted a fresh copy of S29 to: http://www.rodadams.net/Perl/S29.pod http://www.rodadams.net/Perl/S29.html Couple more points from the docs (mostly to the list, but some to you, Rod): multi sub grep (Any|Junction

Re: New S29 draft up

2005-03-17 Thread Rod Adams
Aaron Sherman wrote: On Thu, 2005-03-17 at 18:06 -0600, Rod Adams wrote: This is a SEPARATE need from the need for a repeatable, standard PRNG, and should always operate off of the best source of entropy available to the program. Right now, that's /dev/urandom (for non-blocking hybridized entrop

Re: New S29 draft up

2005-03-17 Thread Aaron Sherman
On Thu, 2005-03-17 at 20:47 -0500, Aaron Sherman wrote: > Methods on numeric values (should be defined as pseudo-methods on > unboxed numbers): > > chr > hex > oct Sigh... well, now I know what Ctrl-Return does in Evolution :-/ Ok, so what I was getting at was that the above thr

Re: New S29 draft up

2005-03-17 Thread Aaron Sherman
On Wed, 2005-03-16 at 02:18 -0600, Rod Adams wrote: > I just posted a fresh copy of S29 to: > > http://www.rodadams.net/Perl/S29.pod > http://www.rodadams.net/Perl/S29.html Couple more points from the docs (mostly to the list, but some to you, Rod): multi sub grep (Any|Junction $test : [EMAIL

Re: New S29 draft up

2005-03-17 Thread Aaron Sherman
On Thu, 2005-03-17 at 18:06 -0600, Rod Adams wrote: First off, thanks for the reply. Very nice work you're doing! > I'll listen to proposals about how to support better randoms. For now I > think C is a standard PRNG. Yes, absolutely. If I gave a contrary impression, I did not mean to. I think

Re: New S29 draft up

2005-03-17 Thread Rod Adams
Aaron Sherman wrote: On Wed, 2005-03-16 at 03:18, Rod Adams wrote: I just posted a fresh copy of S29 to: http://www.rodadams.net/Perl/S29.pod http://www.rodadams.net/Perl/S29.html From there: =head2 Obsolete =item chop Chop removes the last character from a string. Is that no

Re: New S29 draft up

2005-03-17 Thread Aaron Sherman
On Wed, 2005-03-16 at 03:18, Rod Adams wrote: > I just posted a fresh copy of S29 to: > > http://www.rodadams.net/Perl/S29.pod > http://www.rodadams.net/Perl/S29.html >From there: =head2 Obsolete =item chop Chop removes the last character from a string. Is that no longer usef

Re: New S29 draft up

2005-03-17 Thread Juerd
Larry Wall skribis 2005-03-17 9:05 (-0800): > That's what has been specified. > Maybe we need a short-circuit zip: > for @foos ¥¥ 1... -> $foo, $i { ... } Because ¥ is shorter than ¥¥, and because the 1... thing is probably going to be used much, I think it should be the one that returns the

Re: New S29 draft up

2005-03-17 Thread Rod Adams
Larry Wall wrote: On Thu, Mar 17, 2005 at 11:02:47AM +0100, Juerd wrote: : No, as that'd break the most common idiom it introduced: use of an array : with 1..Inf, as in the example you're replying to, but also : : for @foos ¥ 1... -> $foo, $i { ... } Maybe we need a short-circuit zip: for

Re: New S29 draft up

2005-03-17 Thread Larry Wall
On Thu, Mar 17, 2005 at 11:02:47AM +0100, Juerd wrote: : Rod Adams skribis 2005-03-16 23:16 (-0600): : > Doesn't C go until the longest input is exhausted, returning undef : > at the end of the shorter ones? That's what has been specified. : No, as that'd break the most common idiom it introduce

Re: New S29 draft up

2005-03-17 Thread Juerd
Rod Adams skribis 2005-03-16 23:16 (-0600): > Doesn't C go until the longest input is exhausted, returning undef > at the end of the shorter ones? No, as that'd break the most common idiom it introduced: use of an array with 1..Inf, as in the example you're replying to, but also for @foos ¥

Re: New S29 draft up

2005-03-16 Thread Rod Adams
Luke Palmer wrote: Joe Gottman writes: multi sub kv (Array @array : [EMAIL PROTECTED]) returns List Returns the indexes and associated values stored in @array, lazily and in order by index. Optionally, only those of the slice defined by @indices. This one is real easy: multi sub kv (@arr

Re: New S29 draft up

2005-03-16 Thread Luke Palmer
Joe Gottman writes: > multi sub kv (Array @array : [EMAIL PROTECTED]) returns List > Returns the indexes and associated values stored in @array, lazily and in > order by index. Optionally, only those of the slice defined by @indices. This one is real easy: multi sub kv (@array) returns List {

RE: New S29 draft up

2005-03-16 Thread Joe Gottman
> -Original Message- > From: Rod Adams [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 16, 2005 3:18 AM > To: Perl6 Language List > Subject: New S29 draft up > > > I just posted a fresh copy of S29 to: > > http://www.rodadams.net/Perl/S29.pod >

New S29 draft up

2005-03-16 Thread Rod Adams
I just posted a fresh copy of S29 to: http://www.rodadams.net/Perl/S29.pod http://www.rodadams.net/Perl/S29.html New: All defined functions have been restructured into packages. Perl6::Arrays, Perl6::Lists, and Perl6::Hashes are (mostly) written. Some Math::Basic and Math::Trig functions added. :'s