On Fri, Sep 20, 2002 at 09:46:58PM -0600, John Williams wrote: > On Fri, 20 Sep 2002, Jonathan Scott Duff wrote: > > > But I cannot tell whether (7) is list context or numeric context, > > > > Nope, you can't tell without the surrounding context: > > > > (7) + 0; # numeric > > $a = (7); # list > > (7) == 1; # boolean (same as (7).length == 1) > > No, that last one is clearly numeric context. == operates on numbers and > returns boolean.
Oh, you're right. Arrays (and lists I presume by Larry's previous posts) return the number of elements when used in a numeric context. > I can't tell whether (7).length is asking for the length > of 7 or the length of a list, but I would be badly surprised if > (3+4).pow(2) returned 1 instead of 49. So, you expect 7.pow(2) to work? I'd expect it to be an error (this isn't python after all). -Scott -- Jonathan Scott Duff [EMAIL PROTECTED]
