$define RCLANGS "https://rosettacode.org/w/api.php?action=query&generator=categorymembers&gcmtitle=Category:Programming%20Languages&gcmlimit=500&prop=categoryinfo&format=xml" link strings link hexcvt procedure main(A) limit := \A[1] # Limit the output? 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,". ")) if 0 >= (\limit -:= 1) then break } write(*langs, " languages") end # Generate page counts for each language procedure tallyPages() counts := table() continue := "" while \(txt := ReadURL(RCLANGS||continue)) do { txt ? { while tab(find("",&errortext) if page["Status-Code"] < 300 then text := reads(page,-1) else write(&errout,"ERROR: ",&errout," -> ",&errortext) close(page) return text end