On Mon, Dec 27, 2010 at 19:41, Daniel Carrera <dcarr...@gmail.com> wrote:
> Hmm... I think this will only make sense to me if I ask you to define what a
> "term" is, but I am sure that this term (pun intended) is difficult to
> define. In particular, if a number like 5 is a term, then I would think that
> the following expression contains four terms:
> 2 > 3 ?? 5 !! 6
> I figure that 2, 3, 5 and 6 are all terms. Or how about:
> print 5 if 4;
> I'd think that if 5 is a term, then so is 4.
All of your examples are in fact terms. A term is a thing that is
considered one unit. So, numbers, strings, and variables are all
obviously terms. A function or method call that includes parentheses
is also a term. But parentheses can create terms out of expressions,
so, for instance, (5 + 4) is a term (that happens to contain a term,
an operator, and a another term). In the [order of operations] you
will find that terms have the highest precedence, this is why (5+5)*2
is 20, not 15.
> Indeed, it is. Strange. I would have thought that print, with no arguments,
> would give me an error like with "sin". And why does "print" return True?
> What's "True" about it?
It successfully printed nothing. It would return Failure if it failed to print.
Stringifies each element, concatenates those strings,
and sends the result to the output. Returns Bool::True
if successful, Failure otherwise.
> Interesting. I imagine that Multi() means that the function has multiple
> definitions. For example, I expect that "sin" has one implementation for
> floats and another for complex numbers.
Yes, Multi() means it is a multimethod. Multimethods [are routines
that can have multiple variants that share the same name, selected by
arity, types, or some other constraints.]
 : http://perlcabal.org/syn/S03.html#Operator_precedence
 : http://perlcabal.org/syn/S32/IO.html#multi_print_(*...@list_-->_Bool)
 : http://perlcabal.org/syn/S06.html#Routine_modifiers
The most important skill a programmer can have is the ability to read.