[Parrot-users] Language philosophy

Jay Emerson jayemerson at gmail.com
Wed Jul 6 16:20:42 UTC 2011


Is it necessary to have a scalar atomic object (is this called a
literal?), or could this be an array (I'd call it a vector) of length
1?  Relating to my other questions,

sub print(*@args) {
    my $arg := @args[0];
    pir::say(pir::join(' ', $arg));
    pir::return();
}

works if the first argument is an array but not if it is a scalar
integer or float.  So if a scalar integer or float were an array of
length 1 then there wouldn't be those two cases to deal with.  In the
function above, how would I know if $arg contained a scalar (literal)
or an array?

I ask because the + at anarray trick to find the length of an array
worked, but produced a float scalar, leading me to the discovery that
this behaves differently from an array of length 1.  Not a huge
surprise, but leads me to think about how to best organize my 'life'
...

Jay

-- 
John W. Emerson (Jay)
Associate Professor of Statistics
Department of Statistics
Yale University
http://www.stat.yale.edu/~jay


More information about the Parrot-users mailing list