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.
> > @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.
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
> 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 i
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?
>
> Pri
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
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:
>
> >> $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 it
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:
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 ha
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 t
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
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
On Wed, Oct 10, 2001 at 04:04:18PM -0500, Jonathan Scott Duff wrote:
> On Wed, Oct 10, 2001 at 01:27:35PM -0700, Colin Meyer wrote:
> >
> > Does this mean that
> >
> > @a ^+= @b;
> >
> > will add every value of @b to every value of @a?
>
> That's what I'd expect it to do. Well ... that's ass
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
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 Da
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
> > > 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
> >
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
David Whipp 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 4*2**10, 10*2**30) would
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, i
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
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 tha
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 postfi
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?; :
> :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,
> 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?
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 Be
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 sufficient
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;
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 th
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 ima
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 th
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
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 c
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
> > uncomfortabl
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
> | (m
>> 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
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.
| 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?
I li
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
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 i
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 vague as to make me
> uncom
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
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 |
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
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 standa
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 r
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 bloc
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
Bart asked:
> So to what does "123foo" evaluate in numeric context? Now, it produces
> 123. Which is probably useful...
Yes. And I would expect that it will continue to do so.
Perl is primarily about convenience, not consistency ;-)
Damian
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
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 g
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.
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 "
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 'ev
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
> Bart Lateur:
> # On Thu, 4 Oct 2001 03:22:55 -0400, Michael G Schwern wrote:
> #
> # >Binary //
> # >
> # >The analogy to || is probably a bit too clever. My first reaction
> # >was it's some sort of weird division operator. But it's
> servicable.
> #
> # I think it's very cute. I think of it
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 t
59 matches
Mail list logo