Anonymous user
Rosetta Code/Rank languages by popularity: Difference between revisions
Rosetta Code/Rank languages by popularity (view source)
Revision as of 15:57, 30 July 2016
, 7 years ago→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('"'))
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
▲ continue := "&"||tab(upto(' \t'))
▲ }
▲ else return counts
}
}
Line 2,122 ⟶ 2,126:
end</lang>
Abridged output (top
<pre>
1:
2:
3: Python. . . . . . . . . . . . . . . .
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
15:
16:
17:
18:
20:
21:
22:
23:
25: C sharp . . . . . . . . . . . . . . .
26: Icon. . . . . . . . . . . . . . . . .520
...
604 languages
</pre>
|