Function frequency: Difference between revisions
Content added Content deleted
(Add Factor example) |
|||
Line 690: | Line 690: | ||
Function accumulate_functions_name called 1 times. |
Function accumulate_functions_name called 1 times. |
||
Function erlang_source called 1 times. |
Function erlang_source called 1 times. |
||
</pre> |
|||
=={{header|Factor}}== |
|||
Let's take a look at the <code>sequences</code> vocabulary/source file from Factor's standard library. Caveats: this approach does not count word-defining words such as <code>:</code> and <code>M:</code>, nor does it count words like <code>{</code> and <code>[</code>. Arguably, this is preferable behavior. |
|||
<lang factor>USING: accessors kernel math.statistics prettyprint sequences |
|||
sequences.deep source-files vocabs words ; |
|||
"resource:core/sequences/sequences.factor" "sequences" |
|||
[ path>source-file top-level-form>> ] |
|||
[ vocab-words [ def>> ] [ ] map-as ] bi* compose [ word? ] |
|||
deep-filter sorted-histogram <reversed> 7 head .</lang> |
|||
{{out}} |
|||
<pre> |
|||
{ |
|||
{ if 54 } |
|||
{ dup 53 } |
|||
{ drop 46 } |
|||
{ dip 44 } |
|||
{ swap 42 } |
|||
{ length 39 } |
|||
{ keep 36 } |
|||
} |
|||
</pre> |
</pre> |
||