Function frequency: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) (Rename Perl 6 -> Raku, alphabetize, minor clean-up) |
|||
Line 85:
(LIST . 3))
<state>)</pre>
=={{header|AWK}}==
<lang AWK>
Line 1,151 ⟶ 1,152:
2 @top_ten_by_occurrence
2 PPI::Tokenizer</pre>
=={{header|Perl 6}}==▼
Here we just examine the ast of the Perl 6 compiler (which is written in Perl 6) to look for function calls.▼
<lang perl6>my $text = qqx[perl6 --target=ast @*ARGS[]];▼
my %fun;▼
for $text.lines {▼
%fun{$0}++ if / '(call &' (.*?) ')' /▼
}▼
for %fun.invert.sort.reverse[^10] { .value.say }</lang>▼
{{out}}▼
Here we run it on the strand sort RC entry. Note how Perl 6 considers various operators to really be function calls underneath.▼
<pre>$ ./morefun strand▼
pop▼
postcircumfix:<[ ]>▼
unshift▼
succeed▼
splice▼
prefix:<->▼
push▼
infix:<,>▼
infix:<..>▼
infix:<-></pre>▼
=={{header|Phix}}==
Line 1,355 ⟶ 1,333:
</lang>
(formerly Perl 6)
▲Here we just examine the ast of the Perl 6 compiler (which is written in Perl 6) to look for function calls.
▲<lang perl6>my $text = qqx[perl6 --target=ast @*ARGS[]];
▲my %fun;
▲for $text.lines {
▲ %fun{$0}++ if / '(call &' (.*?) ')' /
▲}
▲for %fun.invert.sort.reverse[^10] { .value.say }</lang>
▲{{out}}
▲Here we run it on the strand sort RC entry. Note how Perl 6 considers various operators to really be function calls underneath.
▲<pre>$ ./morefun strand
▲pop
▲postcircumfix:<[ ]>
▲unshift
▲succeed
▲splice
▲prefix:<->
▲push
▲infix:<,>
▲infix:<..>
▲infix:<-></pre>
=={{header|REXX}}==
|