Re: Literals, take 2

2002-11-19 Thread Larry Wall
On Mon, Nov 18, 2002 at 07:39:43PM +, Graham Barr wrote: : On Mon, Nov 18, 2002 at 10:59:07AM -0800, Larry Wall wrote: : > I'm thinking at the moment that I'd like to go back to the Ada notation : > and use # for the radix, and rather that using dots, use colons. So : > an IP address would act

Re: Literals, take 2

2002-11-18 Thread Bryan C. Warnock
On Mon, 2002-11-18 at 10:08, Erik Steven Harrison wrote: > > -- > > On 17 Nov 2002 11:09:53 -050 > Bryan C. Warnock wrote: > >On Wed, 2002-11-13 at 13:26, Angel Faus wrote: > >> > >> There are many ways to specify literal numeric values in perl, but > >> they default to base 10 for input an

Re: Literals, take 2

2002-11-18 Thread Graham Barr
On Mon, Nov 18, 2002 at 10:59:07AM -0800, Larry Wall wrote: > On Thu, Nov 14, 2002 at 07:40:38PM +0100, Angel Faus wrote: > : I would preferer to limit the usage of "letter notation" to just base > : 11-36, and have n:F = n:f for every n. > : > : It is simpler, and we can always use de "dot notat

Re: Literals, take 2

2002-11-18 Thread Larry Wall
On Thu, Nov 14, 2002 at 07:40:38PM +0100, Angel Faus wrote: : I would preferer to limit the usage of "letter notation" to just base : 11-36, and have n:F = n:f for every n. : : It is simpler, and we can always use de "dot notation" for bigger : bases. I'm thinking at the moment that I'd like t

Re: Literals, take 2

2002-11-18 Thread Erik Steven Harrison
-- On 17 Nov 2002 11:09:53 -050 Bryan C. Warnock wrote: >On Wed, 2002-11-13 at 13:26, Angel Faus wrote: >> >> There are many ways to specify literal numeric values in perl, but >> they default to base 10 for input and output. Once the number has > >Surely, Perl 6 will allow changing the ra

Re: Literals, take 2

2002-11-18 Thread Bryan C. Warnock
On Wed, 2002-11-13 at 13:26, Angel Faus wrote: > > There are many ways to specify literal numeric values in perl, but > they default to base 10 for input and output. Once the number has Surely, Perl 6 will allow changing the radix on a more global scale. use radix(16); # or something of the il

Re: Literals, take 2

2002-11-17 Thread Bryan C. Warnock
On Wed, 2002-11-13 at 14:08, Jonathan Scott Duff wrote: > On Wed, Nov 13, 2002 at 07:26:06PM +0100, Angel Faus wrote: > > For example: > > > > my $x = 18; > > my $y = -18; > > my $z = -256:234.254; # negative number > my $e = 256:-234.254; # error Why? -- Brya

Re: Literals, take 2

2002-11-17 Thread Bryan C. Warnock
On Wed, 2002-11-13 at 14:53, Andrew Wilson wrote: > >> So, can we specify floats in other bases? > > > > Why would you want to? > > Personally I wouldn't. That doesn't mean it's not useful to someone. FWIW, I occasionally work with floating point in base-2 and base-16. Not that that should, b

Re: Literals, take 2

2002-11-16 Thread Dave Storrs
On Fri, Nov 15, 2002 at 12:03:32PM -0800, Larry Wall wrote: > On Thu, Nov 14, 2002 at 12:24:50AM -0800, Dave Storrs wrote: > > : Also, on this subject...what happens if I want to use "letter notation" > : in a base higher than 36? > > What happens then is that people will think you're silly. :-

Re: Literals, take 2

2002-11-15 Thread Larry Wall
On Thu, Nov 14, 2002 at 12:24:50AM -0800, Dave Storrs wrote: : On Wed, Nov 13, 2002 at 12:33:09PM -0800, Larry Wall wrote: : > : 1_2_3_4__5___6 (absurd, but doable) : > : > Nope, _ is allowed only between digits (counting a-f as digits in hex). : > : > Larry : : Does this mean that you

Re: Literals, take 2

2002-11-14 Thread Michael Lazzaro
On Thu, Nov 14, 2002 at 07:40:38PM +0100, Angel Faus wrote: I would preferer to limit the usage of "letter notation" to just base 11-36, and have n:F = n:f for every n. OK, sounds good: being consistent wins. Only bases up to 36 may be expressed with letters. MikeL

Re: Literals, take 2

2002-11-14 Thread Jonathan Scott Duff
On Thu, Nov 14, 2002 at 07:40:38PM +0100, Angel Faus wrote: > Michael Lazzaro escribió: > > We should talk about this. My original proposal was to do this: > > > > (Case 1) base 2-10: use 0..9 > > > > (Case 2) base 11-36: use (0..9, a..z), but allow A..Z such that > > > > 0x00ff == 0x00FF > >

Re: Literals, take 2

2002-11-14 Thread Michael Lazzaro
On Thursday, November 14, 2002, at 11:07 AM, Angel Faus wrote: Larry Mmm.. I thought that the whole purpose of creating a new mailing list was to prevent you from reading it. (Dunno, I suspect that once we get our initial act together (i.e. posts drop from 70 a day to more like 20), this li

Re: Literals, take 2

2002-11-14 Thread Angel Faus
Larry Wall escribió: > : 1_2_3_4__5___6 (absurd, but doable) > > Nope, _ is allowed only between digits (counting a-f as digits in > hex). > > Larry Mmm.. I thought that the whole purpose of creating a new mailing list was to prevent you from reading it. Not that I am against your pre

Re: Literals, take 2

2002-11-14 Thread John J. Trammell
On Thu, Nov 14, 2002 at 11:02:02AM -0600, Jonathan Scott Duff wrote: > Now, it would be nice to have a subroutine that, given a number, could > output in any arbitrary base. Perhaps Perl6 could have a radix() > subroutine that returns a string representation thusly: > > $base = 2; > $n

Re: Literals, take 2

2002-11-14 Thread Angel Faus
Michael Lazzaro escribió: > We should talk about this. My original proposal was to do this: > > (Case 1) base 2-10: use 0..9 > > (Case 2) base 11-36: use (0..9, a..z), but allow A..Z such that > > 0x00ff == 0x00FF > > which seems necessary, IMHO. > > (Case 3) base 37-62: use (0..9,a..z,

Re: Literals, take 2

2002-11-14 Thread Michael Lazzaro
On Thursday, November 14, 2002, at 12:24 AM, Dave Storrs wrote: Does this mean that you can't use _ in numbers if the radix is higher than 16? (For example, in base 20, the letters A-J should be considered to be digits...can you put underscores between them?) No, that should be fine... just

Re: Literals, take 2

2002-11-14 Thread Jonathan Scott Duff
On Wed, Nov 13, 2002 at 04:34:12PM -0500, Joseph F. Ryan wrote: > Well, why would you want a float in any radix? To represent a > fractional part of a whole digit in that radix, of course. Right, but when would you, while writing code, think something like, "I need a base 16 representation of the

Re: Literals, take 2

2002-11-14 Thread Dave Storrs
On Wed, Nov 13, 2002 at 12:33:09PM -0800, Larry Wall wrote: > : 1_2_3_4__5___6 (absurd, but doable) > > Nope, _ is allowed only between digits (counting a-f as digits in hex). > > Larry Does this mean that you can't use _ in numbers if the radix is higher than 16? (For example, in ba

Re: Literals, take 2

2002-11-13 Thread Paul Johnson
On Wed, Nov 13, 2002 at 03:00:07PM -0600, Jonathan Scott Duff wrote: > On Wed, Nov 13, 2002 at 12:33:09PM -0800, Larry Wall wrote: > > : 1_2_3_4__5___6 (absurd, but doable) > > > > Nope, _ is allowed only between digits (counting a-f as digits in hex). > > Ah, good. It has always mildly

Re: Literals, take 2

2002-11-13 Thread Joseph F. Ryan
Jonathan Scott Duff wrote: On Wed, Nov 13, 2002 at 06:38:08PM +, Andrew Wilson wrote: On Wed, Nov 13, 2002 at 07:26:06PM +0100, Angel Faus wrote: For example, the integer 30 can be written in hexadecimal base in two equivalent ways: my $x = 16:1D my $x = 16:1.14 These two represe

Re: Literals, take 2

2002-11-13 Thread Jonathan Scott Duff
On Wed, Nov 13, 2002 at 12:33:09PM -0800, Larry Wall wrote: > : 1_2_3_4__5___6 (absurd, but doable) > > Nope, _ is allowed only between digits (counting a-f as digits in hex). Ah, good. It has always mildly annoyed me in prior perls that 1__2 was a literal 12. -Scott -- Jonathan Scot

Re: Literals, take 2

2002-11-13 Thread Larry Wall
: 1_2_3_4__5___6 (absurd, but doable) Nope, _ is allowed only between digits (counting a-f as digits in hex). Larry

Re: Literals, take 2

2002-11-13 Thread Dave Whipp
> except for obfuscatory purposes. Besides, if we allow dots for > floating point numbers how do we represent this integer: > > 256:234.254 Using this notation is cute: a generalization that lets us specify a strange thing. That are the reasons for using such a thing? 1) an alternative to C 2)

Re: Literals, take 2

2002-11-13 Thread Jonathan Scott Duff
On Wed, Nov 13, 2002 at 07:53:05PM +, Andrew Wilson wrote: > On Wed, Nov 13, 2002 at 01:10:05PM -0600, Jonathan Scott Duff wrote: > > On Wed, Nov 13, 2002 at 06:38:08PM +, Andrew Wilson wrote: > >> On Wed, Nov 13, 2002 at 07:26:06PM +0100, Angel Faus wrote: > >>> For example, the integer 30

Re: Literals, take 2

2002-11-13 Thread Andrew Wilson
On Wed, Nov 13, 2002 at 01:10:05PM -0600, Jonathan Scott Duff wrote: > On Wed, Nov 13, 2002 at 06:38:08PM +, Andrew Wilson wrote: >> On Wed, Nov 13, 2002 at 07:26:06PM +0100, Angel Faus wrote: >>> For example, the integer 30 can be written in hexadecimal base in two >>> equivalent ways: >>> >

Re: Literals, take 2

2002-11-13 Thread Jonathan Scott Duff
On Wed, Nov 13, 2002 at 06:38:08PM +, Andrew Wilson wrote: > On Wed, Nov 13, 2002 at 07:26:06PM +0100, Angel Faus wrote: > > For example, the integer 30 can be written in hexadecimal base in two > > equivalent ways: > > > > my $x = 16:1D > > my $x = 16:1.14 > > > > These two representati

Re: Literals, take 2

2002-11-13 Thread Jonathan Scott Duff
On Wed, Nov 13, 2002 at 07:26:06PM +0100, Angel Faus wrote: > For example: > > my $x = 18; > my $y = -18; my $z = -256:234.254; # negative number my $e = 256:-234.254; # error > Perl allows the underline character, C<_>, to be placed as a separator > betwee

Re: Literals, take 2

2002-11-13 Thread Andrew Wilson
On Wed, Nov 13, 2002 at 07:26:06PM +0100, Angel Faus wrote: > For example, the integer 30 can be written in hexadecimal base in two > equivalent ways: > > my $x = 16:1D > my $x = 16:1.14 > > These two representations are incompatible, so writing something like > C<16:D.13> will generate a c