NaN semantics

2001-10-06 Thread Tim Conrow
Semantic confusion alert! EX3 (great document!) sez: > print "Inflation rate: " and $inflation = +<> > until $inflation != NaN; This requires that C be false, causing the loop to continue until a valid numeric string is entered. For IEEE-type NaN semantics, tha

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

2001-10-06 Thread John Siracusa
On 10/6/01 10:27 PM, Damian Conway wrote: >> Doesn't that mean: >> >> "hello" == 0 && 0 != NaN >> >> will evaluate to true? > > No. 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

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

2001-10-06 Thread Damian Conway
> $a == $b != NaN > > really means this: > > $a == $b && $b != NaN > > But "$a == $b != NaN" is supposed to "[solve] the problem of numerical > comparisons between non-numeric strings." Well, what if: > > $a = 'hello'; > $b = 0; > > Do

EX3: Adverbs and print()

2001-10-06 Thread John Siracusa
>From EX3: > A subroutine's adverbs are specified as part of its normal parameter list, but > separated from its regular parameters by a colon: > > my sub operator:… is prec(\&operator:+($)) ( *@list : $filter //= undef) > { ... > > This specifies that operator:… can take a single scalar adverb, w

Re: Are .key and .value right for Pairs?

2001-10-06 Thread Damian Conway
Very nice. And yes, too many brackets of various kinds. Also $this doesn't really describe what it stores. Maybe $first would be better? And we can also optimize the performance by making the lexicals constant (so the optimizer can hard-wire the method names into the closure). That gives us:

EX3: $a == $b != NaN

2001-10-06 Thread John Siracusa
Okay, so this: 100 < -s $filepath <= 1e6 really means this: 100 < -s $filepath && -s $filepath <= 1e6 which means that this: $a == $b != NaN really means this: $a == $b && $b != NaN But "$a == $b != NaN" is supposed to "[solve] the problem of numerical comparisons between

Re: Are .key and .value right for Pairs?

2001-10-06 Thread Randal L. Schwartz
> "Damian" == Damian Conway <[EMAIL PROTECTED]> writes: Too much typing: Damian> module PAIR; Damian> method car { return .key } Damian> method cdr { return .value } Damian> method AUTOVIVIFY (&default, $name) { Damian> if ($name =~ m/^c([ad]

Re: Customizable default hash and array values.

2001-10-06 Thread Michael G Schwern
On Sun, Oct 07, 2001 at 01:26:53AM +0200, Bart Lateur wrote: > > my $foo = $hash{foo} || 'some default'; > > my $bar = $hash{bar} || 'some other default'; > > What about zero. No problem in Perl 6. my $foo = %hash{foo} // 'some default'; -- Michael G. Schwern <[EMAIL PROTECTED]>

Re: Customizable default hash and array values.

2001-10-06 Thread Bart Lateur
On Fri, 28 Sep 2001 21:27:48 +0200, Johan Vromans wrote: >Michael G Schwern <[EMAIL PROTECTED]> writes: > >> so if $key does not exist you'll get 'some default' instead of undef. > >Except that a more common case is > > my $foo = $hash{foo} || 'some default'; > my $bar = $hash{bar} || 'some oth

Quick EX3 question

2001-10-06 Thread John Siracusa
Are these the same thing? print _@{$data.{costs}}; print _ $data{costs}; -John

Re: TIMTOWT concat / hypo-operators

2001-10-06 Thread Jeremy Howard
Brent Dax wrote: > Edwin Steiner: > # Could there also be *hypo*-operators, i.e. operators which try to > # *lower* (reduce) the dimensionality of their operands to the lowest > # common dim. So > # > # $foo = 5 +^ (1,2); > # > # would set $foo to (5 + 1) + 2 <...> > # > > I don't really see the u

RE: TIMTOWT concat / hypo-operators

2001-10-06 Thread Brent Dax
Edwin Steiner: # Is this going to concat $a,$b and $c? # # $foo = _($a,$b,$c); # # (One way to save underlines and spaces.) # Or would that be: # # $foo = _@($a,$b,$c); That would be C<$foo=join('', $a, $b, $c)>, just like in Perl 5. # BTW: what will these do? # # $a _=_ ($b,$c

TIMTOWT concat / hypo-operators

2001-10-06 Thread Edwin Steiner
Hello! Is this going to concat $a,$b and $c? $foo = _($a,$b,$c); (One way to save underlines and spaces.) Or would that be: $foo = _@($a,$b,$c); BTW: what will these do? $a _=_ ($b,$c); $a ^_= ($b,$c); # (better with hypo-operator?, see below) (WIM in Perl

Re: General Feelings on Apoc 3

2001-10-06 Thread Rafael Garcia-Suarez
David M. Lloyd wrote: > On Thu, 4 Oct 2001, Michael G Schwern wrote: > > > > Backtracking is at the heart of Logic Programming (or Declarative > > > Programming, if you like). This is one of the 3 main programming paradigms > > > (along with procedural and functional). The most popular Declarativ

Re: Hyper-operators and Underscore

2001-10-06 Thread Erik Lechak
Bryan, I guess my biggest complaint was that underscore would be the only single character operator that would be in danger of being lumped into the variable name. I forgot about x . I use it all the time. If x has that constraint why not the underscore. I worked at a place where varia

Re: Hyper-operators and Underscore

2001-10-06 Thread Bryan C . Warnock
On Saturday 06 October 2001 03:47 pm, Erik Lechak wrote: > Thank you for the info. I am more engineer than computer scientist, > so please excuse the ignorance behind these questions. No problem. > > > Except that the operator truly is simply an underscore. But it's also a > > valid iden

Re: Hyper-operators and Underscore

2001-10-06 Thread Erik Lechak
Thanks for the info, Bryan, Thank you for the info. I am more engineer than computer scientist, so please excuse the ignorance behind these questions. > > Except that the operator truly is simply an underscore. But it's also a > valid identifier character, so where it may be confused w

Re: Hyper-operators and Underscore

2001-10-06 Thread Bryan C . Warnock
On Saturday 06 October 2001 04:58 am, Erik Lechak wrote: > a) I just plain don't like to use the "_" key. Hitting the "shift" key > and the "-" key just does not feel right. I call this the > Huffman-Carpel-Tunnel coded argument. That is to say that the more > often an operator is used, make it

TIMTOWT concat / idea: hypo-operators

2001-10-06 Thread Edwin Steiner
Hello! I have some questions about unary _ Is this going to concat $a,$b and $c? $foo = _($a,$b,$c); (One way to save underlines and spaces if you have many operands.) Or would that be: $foo = _@($a,$b,$c); What will these do? $a _=_ ($b,$c); $a ^_= ($b,$c

Re: Hyper concat ^_ ?

2001-10-06 Thread Jeremy Howard
Piers Cawley wrote: > Damian Conway <[EMAIL PROTECTED]> writes: > > >> > my @images = qw( pic1 pic2 pic3) ^_ ('.jpg'); > >> > >> Doesn't that clash with the default currying argument? > > > > No. The DCA is: $^_ > > Duh. I brought this up at the London.pm meeting when Simon previewed >

Re: Hyper concat ^_ ?

2001-10-06 Thread Piers Cawley
Damian Conway <[EMAIL PROTECTED]> writes: >> > my @images = qw( pic1 pic2 pic3) ^_ ('.jpg'); >> >> Doesn't that clash with the default currying argument? > > No. The DCA is: $^_ Duh. I brought this up at the London.pm meeting when Simon previewed this, and he pointed out that I was

SV: Apocalypse 3 was great!

2001-10-06 Thread Davíð Helgason
I completely agree. Although I have found myself agreeing with some of the more complaining mails, I really really like it. Reading it with a friend was like reading litterature. We kept crying up and reading aloud. Really. Larry, your work is worth very very much. d. > -Oprindelig meddelel

Re: Hyper-operators and Underscore

2001-10-06 Thread Jeremy Howard
Erik Lechak wrote: > 2) RFC 082: Arrays: Apply operators element-wise in a list context > (hyper operators) > and > 3) Special variable representing index of array in foreach structure > "$#" maybe (not in apocolypse3, I think) > Hi Eric. Thanks for your comments. Unfortunately it's a little ear

Hyper-operators and Underscore

2001-10-06 Thread Erik Lechak
Hello all, I have been using Perl for years. It is the language of choice for most of my needs. This is my first time posting. I have read Apocalypse 3 and many of your responses. Issues: 1) Binary _or string concatenation 2) RFC 082: Arrays: Apply operators element-wise in a