Function frequency: Difference between revisions

added RPL
m (→‎{{header|Wren}}: Minor tidy)
(added RPL)
Line 2,092:
1 wordsort
0.093000 seconds elapsed for 2200 tokens in 510 lines.</pre>
 
=={{header|RPL}}==
« DUP 1 DUP SUB ROT SWAP + → seps input
« { }
1 input SIZE '''FOR''' j
1 OVER TYPE 5 == ::SF ::CF IFTE
input j DUP SUB
seps OVER POS ::DROP IFT
1 FC? ::+ IFT
'''NEXT'''
» » '<span style="color:blue">TOKNZ</span>' STO <span style="color:grey">''@ ("input" "seps" → { "tokens" } )''</span>
« RCL →STR " /n" <span style="color:blue">TOKNZ</span> → tokens <span style="color:grey">''@ "/n" means "new line" character ''</span>
« { { 0 "" } }
1 tokens SIZE '''FOR''' j
tokens j GET "'" SWAP OVER + +
'''IFERR''' STR→ '''THEN'''
2 OVER SIZE 1 - SUB
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'''
'''NEXT'''
SORT REVLIST 1 10 SUB
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>' <span style="color:blue">FNFREQ</span>
{{out}}
<pre>
1: { :»: 4 :OVER: 4 :«: 4 :+: 3 :SWAP: 3 :GET: 3 :}: 3 :{: 3 :END: 2 :→LIST: 2 }
</pre>
 
=={{header|Sidef}}==
1,150

edits