Rosetta Code/Rank languages by popularity: Difference between revisions

→‎By using the API: Corrected to account for changes in the API output
m (→‎REXX program: added/changed comments, whitespace, elide the use of the CUTOFF variable, simplified some statements.)
(→‎By using the API: Corrected to account for changes in the API output)
Line 2,079:
$define RCUA "User-Agent: Unicon Rosetta 0.1"
$define RCXUA "X-Unicon: http://unicon.org/"
 
link strings
link hexcvt
 
procedure main()
cnt := create seq()
last := -1
every pair := !reverse(sort(langs := tallyPages(),2)) do {
n := if last ~=:= pair[2] then @cnt else (@cnt,"")
write(right(n,4),": ",left(pair[1],30,". "),right(pair[2],10,". "))
}
write(*langs, " languages")
end
 
Line 2,099 ⟶ 2,100:
while \(txt := ReadURL(url||continue)) do {
txt ? {
if tab(find("gcmcontinue=")) then {
continue := "&"||tab(upto(' \t"'))
}move(1)
continue ||:= tab(upto('"'))
else return counts }
else continue := ""
while tab(find("<page ") & find(s := "title=\"Category:")+*s) do {
lang := tab(upto('"'))
Line 2,104 ⟶ 2,111:
counts[lang] := numeric(tab(upto('"')))
}
if tab(find("cmcontinuecontinue == "")) then {return counts
continue := "&"||tab(upto(' \t'))
}
else return counts
}
}
Line 2,122 ⟶ 2,126:
end</lang>
 
Abridged output (top 2526 languages as of JuneJuly 730, 20132016):
<pre>
1: Tcl . Racket. . . . . . . . . . . . . . . .743904
2: RacketTcl . . . . . . . . . . . . . . . . .696894
3: Python. . . . . . . . . . . . . . . .679867
4: CJ . . . . . . . . . . . . . . . . . .663852
5: JPerl 6. . . . . . . . . . . . . . . . . .635824
6: PicoLispRuby. . . . . . . . . . . . . . .624 . .796
7: PerlC 6. . . . . . . . . . . . . . . .617 . .777
8: D Go. . . . . . . . . . . . . . . . . .608769
9: RubyJava. . . . . . . . . . . . . . . . .590764
10: GoD . . . . . . . . . . . . . . . . . .586747
11: Ada REXX. . . . . . . . . . . . . . . . .569743
12: MathematicaPerl. . . . . . . . . . . . . . . . .559736
13: Perl. .Haskell . . . . . . . . . . . . . . .548712
14 : HaskellZkl . . . . . . . . . . . . . . . . .540712
15: REXXPicoLisp. . . . . . . . . . . . . . . . .531695
16: BBC BASIC .Mathematica . . . . . . . . . . . . .513686
17: Java.Sidef . . . . . . . . . . . . . . . .508632
18: UniconAda . . . . . . . . . . . . . . . . .478626
19: OCamlC++ . . . . . . . . . . . . . . . . .478619
20: PureBasic AutoHotkey. . . . . . . . . . . . . .467603
21: C++ . Unicon. . . . . . . . . . . . . . . .452578
22: Icon.Common . . .Lisp . . . . . . . . . . . . .445577
23: AutoHotkeyScala . . . . . . . . . . . . . . . .427561
24: CommonBBC LispBASIC . . . . . . . . . . . . . .427535
25: C sharp . . . . . . . . . . . . . . .421529
26: Icon. . . . . . . . . . . . . . . . .520
...
604 languages
</pre>
 
Anonymous user