Function frequency: Difference between revisions
Content added Content deleted
(added RPL) |
(→{{header|RPL}}: improved parsing) |
||
Line 2,110: | Line 2,110: | ||
'''IFERR''' STR→ '''THEN''' |
'''IFERR''' STR→ '''THEN''' |
||
2 OVER SIZE 1 - SUB |
2 OVER SIZE 1 - SUB |
||
'''IF''' "{}][()" OVER POS <span style="color:grey">''@ exclude separators from the count''</span> |
|||
OVER 1 « 2 GET » DOLIST |
|||
''' |
'''THEN''' DROP |
||
''' |
'''ELSE''' |
||
OVER 1 « 2 GET » DOLIST |
|||
'''IF''' OVER POS |
|||
'''THEN''' LASTARG SWAP DROP DUP2 GET { 1 "" } ADD PUT |
|||
'''ELSE''' 1 SWAP 2 →LIST 1 →LIST + END |
|||
'''ELSE''' DROP '''END''' |
|||
'''END''' |
|||
'''NEXT''' |
'''NEXT''' |
||
SORT REVLIST 1 10 SUB |
SORT REVLIST 1 10 SUB |
||
1 « EVAL →TAG » DOLIST |
1 « EVAL →TAG » DOLIST |
||
» » '<span style="color:blue">FNFREQ</span>' STO <span style="color:grey">''@ ( 'program' → { :word:occ .. :word:occ } ''</span> |
» » '<span style="color:blue">FNFREQ</span>' STO <span style="color:grey">''@ ( 'program' → { :word: occ .. :word: occ } ''</span> |
||
'<span style="color:blue">FNFREQ</span>' <span style="color:blue">FNFREQ</span> |
'<span style="color:blue">FNFREQ</span>' <span style="color:blue">FNFREQ</span> |
||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
1: { : |
1: { :OVER: 5 :»: 4 :«: 4 :END: 3 :ELSE: 3 :DROP: 3 :THEN: 3 :+: 3 :SWAP: 3 :GET: 3 } |
||
</pre> |
</pre> |
||