Front page | perl.perl6.language |
Postings from October 2001
EX3: Adverbs and print()
Thread Next
From:
John Siracusa
Date:
October 6, 2001 19:20
Subject:
EX3: Adverbs and print()
Message ID:
B7E53441.2125F%siracusa@mindspring.com
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, which is bound
> to the parameter $filter. When there is no adverb specified in the call,
> $filter is default-assigned the value undef.
So, in the
operator, the filter is the adverb:
$sum =
@costs : {$^_ < 1000};
Does that mean that in the built-in print, the file handle is the only
"in-band" argument, and all the actual items to be printed are merely
adverbs?
print $data.{fh} : $data.{qw(name vers stat)}, _@{$data.{costs}}, $rest;
Or am I confusing uses of the colon?
-John
Thread Next
-
EX3: Adverbs and print()
by John Siracusa