Re: General Feelings on Apoc 3

2001-10-10 Thread Bart Lateur
On Wed, 10 Oct 2001 15:42:29 +1000 (EST), Damian Conway wrote: Brent asked: If we have 'and', 'or' and 'xor', can we have 'dor' (defined or) to be a low-precedence version of this? I actually suggested exactly that to Larry a few weeks back. He likes the idea, but is having trouble

reduce via ^

2001-10-10 Thread John Williams
I just read Apocalypse and Exegesis 3, and something stuck out at me because of its omission, namely using hyper operators for reduction. $a ^+= @list; # should sum the elements of @list Larry says @a ^+ 1 will replicate the scalar value for all a's, and Damian talks about doing summation with

Re: hyperoperators (was: Apocalypse)

2001-10-10 Thread Hugo van der Sanden
Alberto Simoes wrote: :2) using ^ for mapping operators.. this only works with two lists. :The problem here is that we have a pair of lists, and want a :list of pairs. There can be other situations where we have :three lists, instead of a list of tripplets... I thought it was :better to have a

Re: EX3: $a == $b != NaN

2001-10-10 Thread Bart Lateur
On Sun, 7 Oct 2001 12:27:17 +1000 (EST), Damian Conway wrote: The step you're missing is that the non-numeric string hello, when evaluated in a numeric context, produces NaN. So: hello == 0 0 != NaN is: Nan == 0 0 != NaN which is false. So to what does 123foo evaluate in

Re: EX3: Adverbs and print()

2001-10-10 Thread Bart Lateur
On Sat, 06 Oct 2001 22:20:49 -0400, John Siracusa wrote: So, in the … operator, the filter is the adverb: $sum = … @costs : {$^_ 1000}; WTF is that operator? All I see is a black block. We're not in ASCII any more, Toto... -- Bart.

Re: EX3: Adverbs and print()

2001-10-10 Thread Piers Cawley
Bart Lateur [EMAIL PROTECTED] writes: On Sat, 06 Oct 2001 22:20:49 -0400, John Siracusa wrote: So, in the … operator, the filter is the adverb: $sum = … @costs : {$^_ 1000}; WTF is that operator? All I see is a black block. We're not in ASCII any more, Toto... I'm guessing

Re: reduce via ^

2001-10-10 Thread Damian Conway
John observed: I just read Apocalypse and Exegesis 3, and something stuck out at me because of its omission, namely using hyper operators for reduction. $a ^+= @list; # should sum the elements of @list Larry says @a ^+ 1 will replicate the scalar value for all a's,

continuation .... ?

2001-10-10 Thread raptor
hi, Any idea what the continuation will be ? Something similar like while(){..}continue{..} construct, but more primitive/lower-level ? { my $val = 10 } -= { print $val; $val = 11 } -= { print $val } prints 10 and 11 i.e. lexicals of BLOCK1 are preserved for BLOCK2 and BLOCK3 i.e until

Re: EX3: Adverbs and print()

2001-10-10 Thread John Siracusa
On 10/10/01 7:27 AM, Piers Cawley wrote: Bart Lateur [EMAIL PROTECTED] writes: On Sat, 06 Oct 2001 22:20:49 -0400, John Siracusa wrote: So, in the … operator, the filter is the adverb: $sum = … @costs : {$^_ 1000}; WTF is that operator? All I see is a black block. We're not in

Re: NaN semantics

2001-10-10 Thread RaFaL Pocztarski
Damian Conway wrote: But I assume that == means numerically equal (and here I could be wrong). If what I assume is true however, then anything which doesn't have any numerical meaning, numerically compared to anything (even to itself) should not return the misleading result

Re: NaN semantics

2001-10-10 Thread RaFaL Pocztarski
Dan Sugalski wrote: At 08:37 AM 10/9/2001 -0700, Brent Dax wrote: For consistency, I'd prefer to use is: 3+(2 is i). Well, the convention is suffixing an imaginary number with an i. I don't think we'd be too well served to go a different route. So the imaginary numbers would be standard

Re: NaN semantics

2001-10-10 Thread Dan Sugalski
At 05:12 PM 10/10/2001 +0200, RaFaL Pocztarski wrote: Dan Sugalski wrote: At 08:37 AM 10/9/2001 -0700, Brent Dax wrote: For consistency, I'd prefer to use is: 3+(2 is i). Well, the convention is suffixing an imaginary number with an i. I don't think we'd be too well served to go a

More on operators

2001-10-10 Thread Alberto Manuel Brandao Simoes
If we are in the mood of changing operators, can be /\ and || can be \/. At least, mathematicians will like it! Cheers Albie -- | Alberto Manuel Brandão Simões | | [EMAIL PROTECTED] | | http://numexp.sourceforge.net |

Re: NaN semantics

2001-10-10 Thread Sam Vilain
On Wed, 10 Oct 2001 11:32:02 -0400 Dan Sugalski [EMAIL PROTECTED] wrote: Great idea, as well as sqrt(-1) returning 1i istead of raising the exception. If we do them, yep. Currently no promises there. If you do that, make sure it has to be enabled with a pragma. Having complex numbers

Re: NaN semantics

2001-10-10 Thread Dan Sugalski
At 04:42 PM 10/10/2001 +0100, Sam Vilain wrote: On Wed, 10 Oct 2001 11:32:02 -0400 Dan Sugalski [EMAIL PROTECTED] wrote: Great idea, as well as sqrt(-1) returning 1i istead of raising the exception. If we do them, yep. Currently no promises there. If you do that, make sure it has to be

Re: More on operators

2001-10-10 Thread Alberto Manuel Brandao Simoes
On Wed, Oct 10, 2001 at 05:20:06PM +0100, Piers Cawley wrote: ( Alberto Manuel Brandao Simoes [EMAIL PROTECTED] writes: ( ( If we are in the mood of changing operators, can be /\ ( and || can be \/. At least, mathematicians will like it! ( ( You are, of course, joking. No...

Re: NaN semantics

2001-10-10 Thread Trond Michelsen
BTW, I was thinking once that numeral literals like 4k or 10G (meaning 4*2**10, 10*2**30) would be very nice. What do you think? I think the meaning of the suffices are sufficiently vague as to make me uncomfortable supporting them. Is 1K 1024 or 1000? I can make a good case for both, and

Re: NaN semantics

2001-10-10 Thread Jonathan Scott Duff
On Wed, Oct 10, 2001 at 05:21:02PM +0200, raptor wrote: | So the imaginary numbers would be standard literals? Like | | $x=2+10i; | | Great idea, as well as sqrt(-1) returning 1i istead of raising the | exception. BTW, I was thinking once that numeral literals like 4k or 10G | (meaning

Re: NaN semantics

2001-10-10 Thread Aaron Sherman
On Wed, Oct 10, 2001 at 06:20:31PM +0200, Trond Michelsen wrote: BTW, I was thinking once that numeral literals like 4k or 10G (meaning 4*2**10, 10*2**30) would be very nice. What do you think? I think the meaning of the suffices are sufficiently vague as to make me uncomfortable

Re: NaN semantics

2001-10-10 Thread RaFaL Pocztarski
Trond Michelsen wrote: BTW, I was thinking once that numeral literals like 4k or 10G (meaning 4*2**10, 10*2**30) would be very nice. What do you think? I think the meaning of the suffices are sufficiently vague as to make me uncomfortable supporting them. Is 1K 1024 or 1000? I can make a

Re: NaN semantics

2001-10-10 Thread RaFaL Pocztarski
Dan Sugalski wrote: I'll leave that for Larry to decide. I'm just thinking of all the 60G hard drives I see at Best Buy that are really 60e9 bytes, and the 1K ohm resistors that are really 1000 ohms. (Well, give or take a bit for ambient temperature...) I prefer powers of 1024 because it

Re: NaN semantics

2001-10-10 Thread Glenn Linderman
Dan Sugalski wrote: At 04:42 PM 10/10/2001 +0100, Sam Vilain wrote: On Wed, 10 Oct 2001 11:32:02 -0400 Dan Sugalski [EMAIL PROTECTED] wrote: Great idea, as well as sqrt(-1) returning 1i istead of raising the exception. If we do them, yep. Currently no promises there. If you do

Re: NaN semantics

2001-10-10 Thread Glenn Linderman
Trond Michelsen wrote: There's always the possibility of supporting SI's binary prefixes ;) http://physics.nist.gov/cuu/Units/binary.html An excellant idea. I was unaware of that standard, but was trying to head that direction in my last posting. Someone thought it wouldn't work with

Re: NaN semantics

2001-10-10 Thread Bart Lateur
On Wed, 10 Oct 2001 11:52:16 -0400, Dan Sugalski wrote: If people want base 10, let them use e syntax. 1e3 = 1000 1k = 1024 I'll leave that for Larry to decide. I'm just thinking of all the 60G hard drives I see at Best Buy that are really 60e9 bytes, and the 1K ohm resistors that are really

Re: NaN semantics

2001-10-10 Thread Jonathan Scott Duff
On Wed, Oct 10, 2001 at 06:38:05PM +0200, RaFaL Pocztarski wrote: I prefer powers of 1024 because it help a lot more than powers of 1000. But if you think that the ambiguity is the only problem then use kbin; / use kdec; or use k1000; / use k1024; pragmas could solve it. $K = 2**10;

Re: NaN semantics

2001-10-10 Thread Michel Rodriguez
On Wed, 2001-10-10 at 17:32, Dan Sugalski wrote: At 05:12 PM 10/10/2001 +0200, RaFaL Pocztarski wrote: BTW, I was thinking once that numeral literals like 4k or 10G (meaning 4*2**10, 10*2**30) would be very nice. What do you think? I think the meaning of the suffices are sufficiently

Re: NaN semantics

2001-10-10 Thread Dan Sugalski
At 07:01 PM 10/10/2001 +0200, Bart Lateur wrote: On Wed, 10 Oct 2001 11:52:16 -0400, Dan Sugalski wrote: If people want base 10, let them use e syntax. 1e3 = 1000 1k = 1024 I'll leave that for Larry to decide. I'm just thinking of all the 60G hard drives I see at Best Buy that are

RE: NaN semantics

2001-10-10 Thread David Whipp
So the imaginary numbers would be standard literals? Like $x=2+10i; Great idea, as well as sqrt(-1) returning 1i istead of raising the exception. BTW, I was thinking once that numeral literals like 4k or 10G (meaning 4*2**10, 10*2**30) would be very nice. What do you think? -

RE: More on operators

2001-10-10 Thread HellyerP
:Alberto Manuel Brandao Simoes [EMAIL PROTECTED] writes: : :If we are in the mood of changing operators, can be /\ : and || can be \/. At least, mathematicians will like it! : :You are, of course, joking. : :-- :Piers Given Damian's sigma operator in E3, there is no

prefix-postfix [was Re: NaN semantics]

2001-10-10 Thread raptorVD
U mean something like 'term' (or how this thing is called 'bareword' ? ) So I can say : # $x = 10k; my sub operator:number is postfix(k) ($num) { return $num * 1000 } # $x = 10K; my sub operator:number is postfix(K) ($num) { return $num * 1024 } #u can say later print $x if $x?;

Re: prefix-postfix [was Re: NaN semantics]

2001-10-10 Thread Jonathan Scott Duff
On Wed, Oct 10, 2001 at 06:28:42PM +0200, raptorVD wrote: U mean something like 'term' (or how this thing is called 'bareword' ? ) So I can say : # $x = 10k; my sub operator:number is postfix(k) ($num) { return $num * 1000 } I think that would be sub operator:K is postfix

Re: NaN semantics

2001-10-10 Thread Jonathan Scott Duff
On Wed, Oct 10, 2001 at 10:21:38AM -0700, David Whipp wrote: First this thread tells me that 123foo will be 123 in numeric context. Now I find myself wondering what 123indigo evaluates to! It would evaluate to 123. If use complex is in effect, it would evaluate to 123i. At least that's the

Re: NaN semantics

2001-10-10 Thread RaFaL Pocztarski
Glenn Linderman wrote: An excellant idea. I was unaware of that standard, but was trying to head that direction in my last posting. Someone thought it wouldn't work with imaginary numbers, but there actually is no ambiguity if the imaginary i must immediately follow the number, and the

Re: NaN semantics

2001-10-10 Thread RaFaL Pocztarski
Buddha Buck wrote: As someone else pointed out, the e notation is good for powers of 10. How about a corresponding b notation for binary exponents? 4_294_967_296 == 4b30? I really like that idea, it makes the floating point (scientific?) notation symmetric and consistent with X/Xi SI

Re: NaN semantics

2001-10-10 Thread RaFaL Pocztarski
Jonathan Scott Duff wrote: On Wed, Oct 10, 2001 at 10:21:38AM -0700, David Whipp wrote: First this thread tells me that 123foo will be 123 in numeric context. Now I find myself wondering what 123indigo evaluates to! It would evaluate to 123. If use complex is in effect, it would

RE: NaN semantics

2001-10-10 Thread David Whipp
First this thread tells me that 123foo will be 123 in numeric context. Now I find myself wondering what 123indigo evaluates to! It would evaluate to 123. If use complex is in effect, it would evaluate to 123i. At least that's the position I'm taking at the moment ;-) 123i

Re: reduce via ^

2001-10-10 Thread Colin Meyer
On Wed, Oct 10, 2001 at 09:42:58PM +1000, Damian Conway wrote: John observed: I just read Apocalypse and Exegesis 3, and something stuck out at me because of its omission, namely using hyper operators for reduction. $a ^+= @list; # should sum the elements of @list

Re: More on operators

2001-10-10 Thread Piers Cawley
HellyerP [EMAIL PROTECTED] writes: :Alberto Manuel Brandao Simoes [EMAIL PROTECTED] writes: : : If we are in the mood of changing operators, can be /\ : and || can be \/. At least, mathematicians will like it! : :You are, of course, joking. Given Damian's sigma operator

Re: reduce via ^

2001-10-10 Thread Jonathan Scott Duff
On Wed, Oct 10, 2001 at 01:27:35PM -0700, Colin Meyer wrote: On Wed, Oct 10, 2001 at 09:42:58PM +1000, Damian Conway wrote: John observed: I just read Apocalypse and Exegesis 3, and something stuck out at me because of its omission, namely using hyper operators for

Re: reduce via ^

2001-10-10 Thread Aaron Sherman
On Wed, Oct 10, 2001 at 01:27:35PM -0700, Colin Meyer wrote: On Wed, Oct 10, 2001 at 09:42:58PM +1000, Damian Conway wrote: John observed: I just read Apocalypse and Exegesis 3, and something stuck out at me because of its omission, namely using hyper operators for

Re: reduce via ^

2001-10-10 Thread Jonathan Scott Duff
On Wed, Oct 10, 2001 at 02:23:33PM -0700, Colin Meyer wrote: [ @a ^+= @b ] What I'd expect is more like: foreach my $elem (@a) { $elem ^+= @b; } Hrm. Why would you expect that when you'd have written as you just did? Would you also expect @a = @b ^+ @c; to mean

Re: reduce via ^

2001-10-10 Thread Bart Lateur
On Wed, 10 Oct 2001 14:23:33 -0700, Colin Meyer wrote: Does this mean that @a ^+= @b; will add every value of @b to every value of @a? What I'd expect is more like: foreach my $elem (@a) { $elem ^+= @b; } If you want that effect, apply scalar on the RHS. --

Re: reduce via ^

2001-10-10 Thread Colin Meyer
On Wed, Oct 10, 2001 at 04:34:14PM -0500, Jonathan Scott Duff wrote: On Wed, Oct 10, 2001 at 02:23:33PM -0700, Colin Meyer wrote: [ @a ^+= @b ] What I'd expect is more like: foreach my $elem (@a) { $elem ^+= @b; } Hrm. Why would you expect that when you'd have written as

Re: reduce via ^

2001-10-10 Thread Colin Meyer
On Wed, Oct 10, 2001 at 03:41:18PM -0700, Colin Meyer wrote: Maybe this illustrates my confusion: $a = 1; @a = (1); @b = (1, 2, 3); @c = (4, 5, 6); $a = $a ^+ @b; @a = @a ^+ @b; print $a; # 7 print @a; # 7 or 2? Or, after re-reading the apocolypse again, it seems: print @a;

Re: reduce via ^

2001-10-10 Thread Damian Conway
Aaron asked: I'm wondering about some other operators Will there be a ^?? operator? I believe that there will be a hyperoperator for *every* operator. I might, for example, say: @a = @b ^?? 'yea' :: 'nay'; Which I would expect to be the same as:

Re: reduce via ^

2001-10-10 Thread Damian Conway
Colin exemplifies: $a = 1; @a = (1); @b = (1, 2, 3); @c = (4, 5, 6); $a = $a ^+ @b; @a = @a ^+ @b; print $a; # 7 No. It will (probably) print: 4. Because: $a = $a ^+ @b; becomes: $a = ($a,$a,$a) ^+ @b; which is: $a =

Re: reduce via ^

2001-10-10 Thread Damian Conway
$a ^+= @list; # should sum the elements of @list Does this mean that @a ^+= @b; will add every value of @b to every value of @a? No. The rule is that a hyperoperator replicates its lower-dimensional operand up to the same number of dimensions as its

Re: reduce via ^

2001-10-10 Thread Colin Meyer
According to Damian: Colin exemplifies: $a = 1; @a = (1); @b = (1, 2, 3); @c = (4, 5, 6); $a = $a ^+ @b; @a = @a ^+ @b; print $a; # 7 No. It will (probably) print: 4. Because: print @a; # 7 or 2? Prints: 2 2 3. Because:

Re: reduce via ^

2001-10-10 Thread Damian Conway
So, does that mean: $a = ($a) ^+ @b; print $a; # prints: 3 # $a = ($a,undef,undef) ^+ @b ... Yes. My new confusion has to do with why does the hyperoperator expand $a to ($a,$a,$a), but (1) to (1,undef,undef)? Oh, it's because hyper-ops expand an arg if it is

HOF positional args (was Re: reduce via ^)

2001-10-10 Thread Jeremy Howard
Damian Conway wrote: @a ^+= reduce {$^a+$^b} @b; What's this? Are positional args to HOFs now alphabetic rather than numeric? cf. http://dev.perl.org/rfc/23.html#Positional_placeholders

Re: HOF positional args (was Re: reduce via ^)

2001-10-10 Thread Damian Conway
@a ^+= reduce {$^a+$^b} @b; What's this? Are positional args to HOFs now alphabetic rather than numeric? No. I just chose to used named placeholders, since they're more easily followed in this example. cf. http://dev.perl.org/rfc/23.html#Positional_placeholders cf.

BabyPerl 0.02

2001-10-10 Thread Brent Dax
Okay, I've finished version 0.02 of babyperl. In addition to constants, variables, operators, and functions, it now understands comments (in a rudimentary way--watch out if a constant string contains #), if, if/else, unless, unless/else, while, and do/while. I relented and put in _ for concat.