Rosetta Code/Rank languages by number of users: Difference between revisions
m (→{{header|REXX}}: updated the number of computer programming languages that are used on Rosetta Code, based on the number of users.) |
(promoted to (full) task status, added highligthing and whitespace, added a ;Task: section header as well a ;A method ... , ensured URLs will be on one line (not split), elided the forcing of the TOC.) |
||
Line 1: | Line 1: | ||
{{task}} |
|||
{{draft task}}[[Category:Text processing]][[Category:Networking and Web Interaction]][[Category:Sorting]][[Category:Rosetta Code related]] |
|||
[[Category:Text processing]] |
|||
[[Category:Networking and Web Interaction]] |
|||
[[Category:Sorting]] |
|||
[[Category:Rosetta Code related]] |
|||
;Task: |
|||
Sort most popular programming languages based on the number of users on Rosetta Code. |
Sort most popular programming languages based on the number of users on Rosetta Code. |
||
Show the languages with at least 100 users. |
|||
⚫ | |||
Users of a language X are those referenced in the page https://rosettacode.org/wiki/Category:X_User, or preferably https://rosettacode.org/mw/index.php?title=Category:X_User&redirect=no to avoid redirections. In order to find the list of such categories, it's possible to first parse the entries of http://rosettacode.org/mw/index.php?title=Special:Categories&limit=5000. Then download and parse each language users category to count the users. |
|||
⚫ | |||
⚫ | |||
Users of a computer programming language '''X''' are those referenced in the page: |
|||
https://rosettacode.org/wiki/Category:X_User, or preferably: |
|||
https://rosettacode.org/mw/index.php?title=Category:X_User&redirect=no to avoid re-directions. |
|||
In order to find the list of such categories, it's possible to first parse the entries of: |
|||
http://rosettacode.org/mw/index.php?title=Special:Categories&limit=5000. |
|||
Then download and parse each computer language ''users'' category to count the number of users of that computer language. |
|||
⚫ | |||
<pre>Language Users |
<pre>Language Users |
||
-------------------------- |
-------------------------- |
||
Line 26: | Line 40: | ||
A Rosetta Code user usually declares using a language with the [[Template:Mylang|mylang]] template. This template is expected to appear on the User page. However, in some cases it appears in a user Talk page. It's not necessary to take this into account. For instance, among the 373 C users in the table above, 3 are actually declared in a Talk page. |
A Rosetta Code user usually declares using a language with the [[Template:Mylang|mylang]] template. This template is expected to appear on the User page. However, in some cases it appears in a user Talk page. It's not necessary to take this into account. For instance, among the 373 C users in the table above, 3 are actually declared in a Talk page. |
||
<br><br> |
|||
__TOC__ |
|||
=={{header|Go}}== |
=={{header|Go}}== |
Revision as of 00:06, 8 April 2021
You are encouraged to solve this task according to the task description, using any language you may know.
- Task
Sort most popular programming languages based on the number of users on Rosetta Code.
Show the languages with at least 100 users.
- A method to solve the task
Users of a computer programming language X are those referenced in the page:
https://rosettacode.org/wiki/Category:X_User, or preferably: https://rosettacode.org/mw/index.php?title=Category:X_User&redirect=no to avoid re-directions.
In order to find the list of such categories, it's possible to first parse the entries of:
http://rosettacode.org/mw/index.php?title=Special:Categories&limit=5000.
Then download and parse each computer language users category to count the number of users of that computer language.
Sample output on 18 February 2019:
Language Users -------------------------- C 391 Java 276 C++ 275 Python 262 JavaScript 238 Perl 171 PHP 167 SQL 138 UNIX Shell 131 BASIC 120 C sharp 118 Pascal 116 Haskell 102
A Rosetta Code user usually declares using a language with the mylang template. This template is expected to appear on the User page. However, in some cases it appears in a user Talk page. It's not necessary to take this into account. For instance, among the 373 C users in the table above, 3 are actually declared in a Talk page.
Go
<lang go>package main
import (
"fmt" "io/ioutil" "net/http" "regexp" "sort" "strconv"
)
type Result struct {
lang string users int
}
func main() {
const minimum = 25 ex := `"Category:(.+?)( User)?"(\}|,"categoryinfo":\{"size":(\d+),)` re := regexp.MustCompile(ex) page := "http://rosettacode.org/mw/api.php?" action := "action=query" format := "format=json" fversion := "formatversion=2" generator := "generator=categorymembers" gcmTitle := "gcmtitle=Category:Language%20users" gcmLimit := "gcmlimit=500" prop := "prop=categoryinfo" rawContinue := "rawcontinue=" page += fmt.Sprintf("%s&%s&%s&%s&%s&%s&%s&%s", action, format, fversion, generator, gcmTitle, gcmLimit, prop, rawContinue) resp, _ := http.Get(page) body, _ := ioutil.ReadAll(resp.Body) matches := re.FindAllStringSubmatch(string(body), -1) resp.Body.Close() var results []Result for _, match := range matches { if len(match) == 5 { users, _ := strconv.Atoi(match[4]) if users >= minimum { result := Result{match[1], users} results = append(results, result) } } } sort.Slice(results, func(i, j int) bool { return results[j].users < results[i].users })
fmt.Println("Rank Users Language") fmt.Println("---- ----- --------") rank := 0 lastUsers := 0 lastRank := 0 for i, result := range results { eq := " " rank = i + 1 if lastUsers == result.users { eq = "=" rank = lastRank } else { lastUsers = result.users lastRank = rank } fmt.Printf(" %-2d%s %3d %s\n", rank, eq, result.users, result.lang) }
}</lang>
- Output:
Rank Users Language ---- ----- -------- 1 397 C 2 278 C++ 2 = 278 Java 4 266 Python 5 240 JavaScript 6 171 Perl 7 168 PHP 8 139 SQL 9 131 UNIX Shell 10 121 C sharp 11 120 BASIC 12 118 Pascal 13 102 Haskell 14 93 Ruby 15 81 Fortran 16 70 Visual Basic 17 65 Prolog 18 61 Scheme 19 59 Common Lisp 20 58 AWK 20= 58 Lua 22 52 HTML 23 46 Batch File 24 45 Assembly 24= 45 X86 Assembly 26 43 Bash 27 40 Erlang 27= 40 MATLAB 29 39 Lisp 30 38 Forth 31 36 Visual Basic .NET 31= 36 Delphi 33 35 APL 33= 35 J 35 34 Tcl 35= 34 Brainf*** 37 33 Objective-C 38 32 COBOL 38= 32 R 40 30 Go 40= 30 Mathematica 42 29 Perl 6 43 27 Clojure 44 25 OCaml 44= 25 AutoHotkey 44= 25 REXX
Perl
<lang perl>use strict; use warnings; use JSON; use URI::Escape; use LWP::UserAgent;
my $client = LWP::UserAgent->new; $client->agent("Rosettacode Perl task solver"); my $url = 'http://rosettacode.org/mw'; my $minimum = 100;
sub uri_query_string {
my(%fields) = @_; 'action=query&format=json&formatversion=2&' . join '&', map { $_ . '=' . uri_escape($fields{$_}) } keys %fields
}
sub mediawiki_query {
my($site, $type, %query) = @_; my $url = "$site/api.php?" . uri_query_string(%query); my %languages = ();
my $req = HTTP::Request->new( GET => $url ); my $response = $client->request($req); $response->is_success or die "Failed to GET '$url': ", $response->status_line; my $data = decode_json($response->content); for my $row ( @{${$data}{query}{pages}} ) { next unless defined $$row{categoryinfo} && $$row{title} =~ /User/; my($title) = $$row{title} =~ /Category:(.*?) User/; my($count) = $$row{categoryinfo}{pages}; $languages{$title} = $count; } %languages;
}
my %table = mediawiki_query(
$url, 'pages', ( generator => 'categorymembers', gcmtitle => 'Category:Language users', gcmlimit => '999', prop => 'categoryinfo', rawcontinue => , )
);
for my $k (sort { $table{$b} <=> $table{$a} } keys %table) {
printf "%4d %s\n", $table{$k}, $k if $table{$k} > $minimum;
}</lang>
- Output:
397 C 278 Java 278 C++ 266 Python 240 JavaScript 171 Perl 168 PHP 139 SQL 131 UNIX Shell 121 C sharp 120 BASIC 118 Pascal 102 Haskell
Phix
See Rank languages by popularity, just set output_users to true.
- Output:
1: 397 - C 2: 278 - C++ =: 278 - Java 4: 266 - Python 5: 240 - JavaScript 6: 171 - Perl 7: 168 - PHP 8: 139 - SQL 9: 131 - UNIX Shell 10: 121 - C sharp 11: 120 - BASIC 12: 118 - Pascal 13: 102 - Haskell 14: 93 - Ruby 15: 81 - Fortran 16: 70 - Visual Basic 17: 65 - Prolog 18: 61 - Scheme 19: 59 - Common Lisp 20: 58 - AWK
Racket
Note: the implementation is very similar to Rank languages by popularity.
<lang racket>#lang racket
(require racket/hash
net/url json)
(define limit 64) (define (replacer cat) (regexp-replace #rx"^Category:(.*?) User$" cat "\\1")) (define category "Category:Language users") (define entries "users")
(define api-url (string->url "http://rosettacode.org/mw/api.php")) (define (make-complete-url gcmcontinue)
(struct-copy url api-url [query `([format . "json"] [action . "query"] [generator . "categorymembers"] [gcmtitle . ,category] [gcmlimit . "200"] [gcmcontinue . ,gcmcontinue] [continue . ""] [prop . "categoryinfo"])]))
(define @ hash-ref)
(define table (make-hash))
(let loop ([gcmcontinue ""])
(define resp (read-json (get-pure-port (make-complete-url gcmcontinue)))) (hash-union! table (for/hash ([(k v) (in-hash (@ (@ resp 'query) 'pages))]) (values (@ v 'title #f) (@ (@ v 'categoryinfo (hash)) 'size 0)))) (cond [(@ resp 'continue #f) => (λ (c) (loop (@ c 'gcmcontinue)))]))
(for/fold ([prev #f] [rank #f] #:result (void))
([item (in-list (sort (hash->list table) > #:key cdr))] [i (in-range limit)]) (match-define (cons cat size) item) (define this-rank (if (equal? prev size) rank (add1 i))) (printf "Rank: ~a ~a ~a\n" (~a this-rank #:align 'right #:min-width 2) (~a (format "(~a ~a)" size entries) #:align 'right #:min-width 14) (replacer cat)) (values size this-rank))</lang>
- Output:
Rank: 1 (402 users) C Rank: 2 (283 users) Java Rank: 3 (281 users) C++ Rank: 4 (270 users) Python Rank: 5 (243 users) JavaScript Rank: 6 (175 users) Perl Rank: 7 (171 users) PHP Rank: 8 (142 users) SQL Rank: 9 (134 users) UNIX Shell Rank: 10 (123 users) C sharp Rank: 10 (123 users) BASIC Rank: 12 (119 users) Pascal Rank: 13 (105 users) Haskell Rank: 14 (94 users) Ruby Rank: 15 (83 users) Fortran Rank: 16 (71 users) Visual Basic Rank: 17 (67 users) Prolog Rank: 18 (63 users) Scheme Rank: 19 (61 users) Common Lisp Rank: 20 (59 users) AWK Rank: 20 (59 users) Lua Rank: 22 (52 users) HTML Rank: 23 (46 users) X86 Assembly Rank: 23 (46 users) Batch File Rank: 23 (46 users) Assembly Rank: 26 (44 users) Bash Rank: 27 (40 users) Erlang Rank: 27 (40 users) MATLAB Rank: 29 (39 users) Forth Rank: 29 (39 users) Lisp Rank: 31 (37 users) Visual Basic .NET Rank: 32 (36 users) APL Rank: 32 (36 users) Tcl Rank: 32 (36 users) Delphi Rank: 35 (35 users) J Rank: 36 (34 users) Brainf*** Rank: 37 (33 users) COBOL Rank: 37 (33 users) Objective-C Rank: 39 (32 users) Go Rank: 39 (32 users) R Rank: 41 (30 users) Mathematica Rank: 42 (29 users) Perl 6 Rank: 43 (28 users) Clojure Rank: 44 (25 users) OCaml Rank: 44 (25 users) AutoHotkey Rank: 44 (25 users) REXX Rank: 47 (24 users) PostScript Rank: 48 (23 users) Sed Rank: 48 (23 users) Emacs Lisp Rank: 48 (23 users) LaTeX Rank: 51 (22 users) VBScript Rank: 51 (22 users) CSS Rank: 51 (22 users) MySQL Rank: 51 (22 users) Scala Rank: 55 (20 users) XSLT Rank: 55 (20 users) Racket Rank: 57 (19 users) 6502 Assembly Rank: 58 (18 users) Z80 Assembly Rank: 58 (18 users) Logo Rank: 60 (17 users) Factor Rank: 60 (17 users) Make Rank: 60 (17 users) 8086 Assembly Rank: 60 (17 users) F Sharp Rank: 64 (16 users) PL/I
Raku
(formerly Perl 6)
Use the mediawiki API rather than web scraping since it is much faster and less resource intensive. Show languages with more than 25 users since that is still a pretty short list and to demonstrate how tied rankings are handled. Change the $minimum parameter to adjust what the cut-off point will be.
This is all done in a single pass; ties are not detected until a language has the same count as a previous one, so ties are marked by a T next to the count indicating that this language has the same count as the previous.
<lang perl6>use HTTP::UserAgent; use URI::Escape; use JSON::Fast;
my $client = HTTP::UserAgent.new;
my $url = 'http://rosettacode.org/mw';
my $start-time = now;
say "========= Generated: { DateTime.new(time) } =========";
my $lang = 1; my $rank = 0; my $last = 0; my $tie = ' '; my $minimum = 25;
.say for
mediawiki-query( $url, 'pages', :generator<categorymembers>, :gcmtitle<Category:Language users>, :gcmlimit<350>, :rawcontinue(), :prop<categoryinfo> )
.map({ %( count => .<categoryinfo><pages> || 0, lang => .<title>.subst(/^'Category:' (.+) ' User'/, ->$/ {$0}) ) })
.sort( { -.<count>, .<lang> } )
.map( { last if .<count> < $minimum; display(.<count>, .<lang>) } );
say "========= elapsed: {(now - $start-time).round(.01)} seconds =========";
sub display ($count, $which) {
if $last != $count { $last = $count; $rank = $lang; $tie = ' ' } else { $tie = 'T' }; sprintf "#%3d Rank: %2d %s with %-4s users: %s", $lang++, $rank, $tie, $count, $which;
}
sub mediawiki-query ($site, $type, *%query) {
my $url = "$site/api.php?" ~ uri-query-string( :action<query>, :format<json>, :formatversion<2>, |%query); my $continue = ;
gather loop { my $response = $client.get("$url&$continue"); my $data = from-json($response.content); take $_ for $data.<query>.{$type}.values; $continue = uri-query-string |($data.<query-continue>{*}».hash.hash or last); }
}
sub uri-query-string (*%fields) {
join '&', %fields.map: { "{.key}={uri-escape .value}" }
}</lang>
- Output:
========= Generated: 2018-06-01T22:09:26Z ========= # 1 Rank: 1 with 380 users: C # 2 Rank: 2 with 269 users: Java # 3 Rank: 3 with 266 users: C++ # 4 Rank: 4 with 251 users: Python # 5 Rank: 5 with 234 users: JavaScript # 6 Rank: 6 with 167 users: Perl # 7 Rank: 7 with 166 users: PHP # 8 Rank: 8 with 134 users: SQL # 9 Rank: 9 with 125 users: UNIX Shell # 10 Rank: 10 with 119 users: BASIC # 11 Rank: 11 with 116 users: C sharp # 12 Rank: 12 with 112 users: Pascal # 13 Rank: 13 with 99 users: Haskell # 14 Rank: 14 with 93 users: Ruby # 15 Rank: 15 with 74 users: Fortran # 16 Rank: 16 with 67 users: Visual Basic # 17 Rank: 17 with 62 users: Prolog # 18 Rank: 18 with 61 users: Scheme # 19 Rank: 19 with 58 users: Common Lisp # 20 Rank: 20 with 55 users: Lua # 21 Rank: 21 with 53 users: AWK # 22 Rank: 22 with 52 users: HTML # 23 Rank: 23 with 46 users: Assembly # 24 Rank: 24 with 44 users: Batch File # 25 Rank: 25 with 42 users: Bash # 26 Rank: 25 T with 42 users: X86 Assembly # 27 Rank: 27 with 40 users: Erlang # 28 Rank: 28 with 38 users: Forth # 29 Rank: 29 with 37 users: MATLAB # 30 Rank: 30 with 36 users: Lisp # 31 Rank: 31 with 35 users: J # 32 Rank: 31 T with 35 users: Visual Basic .NET # 33 Rank: 33 with 34 users: Delphi # 34 Rank: 34 with 33 users: APL # 35 Rank: 34 T with 33 users: Ada # 36 Rank: 34 T with 33 users: Brainf*** # 37 Rank: 34 T with 33 users: Objective-C # 38 Rank: 34 T with 33 users: Tcl # 39 Rank: 39 with 32 users: R # 40 Rank: 40 with 31 users: COBOL # 41 Rank: 41 with 30 users: Go # 42 Rank: 42 with 29 users: Perl 6 # 43 Rank: 43 with 27 users: Clojure # 44 Rank: 43 T with 27 users: Mathematica # 45 Rank: 45 with 25 users: AutoHotkey ========= elapsed: 1.45 seconds =========
REXX
(Native) REXX doesn't support web-page reading, so the mentioned Rosetta Code categories and
Rosetta Code Languages were downloaded to local files.
This program reads the Languages file (looking for a language user) and uses the contents of
that file for a validation of the categories file.
This essentially is a perfect filter for the Rosetta Code categories file.
The catHeap variable in the REXX program is just a long string of all the records in the web-file of the
Rosetta Code categories, with a special character (sep) that separates each count of users
for a computer programming language entry (name).
The mechanism is to use a (sparse) stemmed array which holds only the names of languages which
(for most REXXes) uses a hashing algorithm to locate the entry (which is very fast).
Programming note: (REXX doesn't handle Unicode characters) some special cases that are translated:
- ╬£C++ translated into µC++ [Greek micro]
- ╨£╨Ü-61/52 translated into MK-61/52 [Cyrillic МК-61/52])
- ??-61/52 translated into MK-61/52 [Cyrillic МК-61/52])
- D├⌐j├á Vu translated into Déjà Vu
- Cach├⌐ translated into Caché
- F┼ìrmul├ª translated into Fôrmulæ
- உயிர்/Uyir translated into Uyir
- МiniZinc translated into MiniZinc
(The 3rd entry is most likely caused by the inability to render unsupported glyphs when it was first used to add that language.)
Code was added to support the renaming of the computer programming language Perl 6 ──► Raku.
Note that this REXX example properly ranks tied languages. <lang rexx>/*REXX program reads 2 files & displays a ranked list of Rosetta Code languages by users*/ parse arg catFID lanFID outFID . /*obtain optional arguments from the CL*/ call init /*initialize some REXX variables. */ call get /*obtain data from two separate files. */ call eSort #,0 /*sort languages along with members. */ call tSort /* " " that are tied in rank.*/ call eSort #,1 /* " " along with members. */ call out /*create the RC_USER.OUT (output) file.*/ exit 0 /*stick a fork in it, we're all done. */ /*──────────────────────────────────────────────────────────────────────────────────────*/ commas: parse arg _; do jc=length(_)-3 to 1 by -3; _= insert(",",_,jc); end; return _ s: if arg(1)==1 then return arg(3); return word(arg(2) 's',1) /*pluralizer.*/ /*──────────────────────────────────────────────────────────────────────────────────────*/ eSort: procedure expose #. @. !tr.; arg N,p2; h= N /*sort: number of members*/
do while h>1; h= h % 2 /*halve number of records*/ do i=1 for N-h; j= i; k= h + i /*sort this part of list.*/ if p2 then do while !tR.k==!tR.j & @.k>@.j /*this uses a hard swap ↓*/ @= @.j; #= !tR.j; @.j= @.k; !tR.j= !tR.k; @.k= @; !tR.k= # if h>=j then leave; j= j - h; k= k - h end /*while !tR.k==···*/ else do while #.k<#.j /*this uses a hard swap ↓*/ @= @.j; #= #.j; @.j= @.k; #.j= #.k; @.k= @; #.k= # if h>=j then leave; j= j - h; k= k - h end /*while #.k<···*/ end /*i*/ /*hard swaps needed for embedded blanks.*/ end /*while h>1*/; return
/*──────────────────────────────────────────────────────────────────────────────────────*/ get: langs= 0; call rdr 'languages' /*assign languages ───► L.ααα */
call rdr 'categories' /*append categories ───► catHeap */ #= 0 do j=1 until catHeap== /*process the heap of categories. */ parse var catHeap cat.j (sep) catHeap /*get a category from the catHeap. */ parse var cat.j cat.j '<' "(" mems . /*untangle the strange─looking string. */ cat.j= space(cat.j); ?=cat.j; upper ? /*remove any superfluous blanks. */ if ?== | \L.? then iterate /*it's blank or it's not a language. */ if pos(',', mems)\==0 then mems= space(translate(mems,,","), 0) /*¬commas.*/ if \datatype(mems, 'W') then iterate /*is the "members" number not numeric? */ #.0= #.0 + mems /*bump the number of members found. */ if u.?\==0 then do; do f=1 for # until ?==@u.f end /*f*/ #.f= #.f + mems; iterate j /*languages in different cases.*/ end /* [↑] handle any possible duplicates.*/ u.?= u.? + 1; #= # + 1 /*bump a couple of counters. */ #.#= #.# + mems; @.#= cat.j; @u.#=? /*bump the counter; assign it (upper).*/ end /*j*/
!.=; @tno= '(total) number of' /*array holds indication of TIED langs.*/ call tell right(commas(#), 9) @tno 'languages detected in the category file' call tell right(commas(langs),9) ' " " " " " " " language "' call tell right(commas(#.0), 9) @tno 'entries (users of lanugages) detected', , 1 term= 0 return /*don't show any more msgs──►term. [↑] */
/*──────────────────────────────────────────────────────────────────────────────────────*/ init: sep= '█'; L.=0; #.=0; u.=#.; catHeap=; term=1; old.= /*assign some REXX vars*/
if catFID== then catFID= "RC_USER.CAT" /*Not specified? Then use the default.*/ if lanFID== then lanFID= "RC_USER.LAN" /* " " " " " " */ if outFID== then outFID= "RC_USER.OUT" /* " " " " " " */ call tell center('timestamp: ' date() time("Civil"),79,'═'), 2, 1; return
/*──────────────────────────────────────────────────────────────────────────────────────*/ out: w= length( commas(#) ); rank= 0 /* [↓] show by ascending rank of lang.*/
do t=# by -1 for #; rank= rank + 1 /*bump rank of a programming language. */ call tell right('rank:' right(commas(!tR.t), w), 20-1) right(!.t, 7), right('('commas(#.t) left("entr"s(#.t, 'ies', "y")')', 9), 20) @.t end /*#*/ /* [↑] S(···) pluralizes a word. */ call tell left(, 27) "☼ end─of─list. ☼", 1, 2; return /*bottom title.*/
/*──────────────────────────────────────────────────────────────────────────────────────*/ rdr: arg which 2; igAst= 1 /*ARG uppers WHICH, obtain the 1st char*/
if which=='L' then inFID= lanFID /*use this fileID for the languages. */ if which=='C' then inFID= catFID /* " " " " " categories. */ Uyir= 'α«ëα«»α«┐α«░α»ì/Uyir' /*Unicode (in text) name for Uyir */ old.0= '╬£C++' ; new.0= "µC++" /*Unicode ╬£C++ ───► ASCII─8: µC++ */ old.1= 'UC++' ; new.1= "µC++" /*old UC++ ───► ASCII─8: µC++ */ old.2= '╨£╨Ü-' ; new.2= "MK-" /*Unicode ╨£╨Ü─ ───► ASCII-8: MK- */ old.3= 'D├⌐j├á' ; new.3= "Déjà" /*Unicode ├⌐j├á ───► ASCII─8: Déjà */ old.4= 'Cach├⌐' ; new.4= "Caché" /*Unicode Cach├⌐ ───► ASCII─8: Caché */ old.5= '??-61/52' ; new.5= "MK-61/52" /*somewhere past, a mis─translated: MK-*/ old.6= 'F┼ìrmul├ª' ; new.6= 'Fôrmulæ' /*Unicode ───► ASCII─8: Fôrmulæ */ old.7= '╨£iniZinc' ; new.7= 'MiniZinc' /*Unicode ───► ASCII─8: MiniZinc*/ old.8= Uyir ; new.8= 'Uyir' /*Unicode ───► ASCII─8: Uyir */ old.9= 'Perl 6' ; new.9= 'Raku' /* (old name) ───► (new name) */
do recs=0 while lines(inFID) \== 0 /*read a file, a single line at a time.*/ $= translate( linein(inFID), , '9'x) /*handle any stray TAB ('09'x) chars.*/ $$= space($); if $$== then iterate /*ignore all blank lines in the file(s)*/ do v=0 while old.v \== /*translate Unicode variations of langs*/ if pos(old.v, $$) \==0 then $$= changestr(old.v, $$, new.v) end /*v*/ /* [↑] handle different lang spellings*/ if igAst then do; igAst= pos(' * ', $)==0; if igAst then iterate; end if pos('RETRIEVED FROM', translate($$))\==0 then leave /*pseudo End─Of─Data?.*/ if which=='L' then do; if left($$, 1)\=="*" then iterate /*lang ¬legitimate?*/ parse upper var $$ '*' $$ "<"; $$= space($$) if $$== then iterate $$= $$ 'USER' L.$$= 1 langs= langs + 1 /*bump # of languages/users found.*/ iterate end /* [↓] extract computer language name.*/ if left($$, 1)=='*' then $$= sep || space( substr($$, 2) ) catHeap= catHeap $$ /*append to the catHeap (CATegory) heap*/ end /*recs*/ call tell right( commas(recs), 9) 'records read from file: ' inFID return
/*──────────────────────────────────────────────────────────────────────────────────────*/ tell: do '0'arg(2); call lineout outFID," " ; if term then say ; end
call lineout outFID,arg(1) ; if term then say arg(1) do '0'arg(3); call lineout outFID," " ; if term then say ; end return /*show BEFORE blank lines (if any), message, show AFTER blank lines.*/
/*──────────────────────────────────────────────────────────────────────────────────────*/ tSort: tied=; r= 0 /*add true rank (tR) ───► the entries. */
do j=# by -1 for #; r= r+1; tR= r; !tR.j= r; jp= j+1; jm= j-1 if tied== then pR= r; tied= /*handle when language rank is untied. */ if #.j==#.jp | #.j==#.jm then do; !.j= '[tied]'; tied= !.j; end if #.j==#.jp then do; tR= pR; !tR.j= pR; end else pR= r end /*j*/; return</lang>
- output when using the default inputs:
═════════════════════════timestamp: 7 Apr 2021 6:44pm═════════════════════════ 1,094 records read from file: RC_USER.LAN 7,641 records read from file: RC_USER.CAT 474 (total) number of languages detected in the category file 835 " " " " " " " language " 6,057 (total) number of entries (users of lanugages) detected rank: 1 (424 entries) C User rank: 2 (309 entries) JAVA User rank: 3 (302 entries) C++ User rank: 4 (299 entries) Python User rank: 5 (280 entries) JavaScript User rank: 6 (183 entries) PHP User rank: 7 (181 entries) Perl User rank: 8 (158 entries) SQL User rank: 9 (151 entries) UNIX Shell User rank: 10 (132 entries) C Sharp User rank: 11 [tied] (130 entries) BASIC User rank: 11 [tied] (130 entries) Pascal User rank: 13 (111 entries) Haskell User rank: 14 (102 entries) Ruby User rank: 15 (96 entries) FORTRAN User rank: 16 (73 entries) Visual Basic User rank: 17 [tied] (70 entries) Prolog User rank: 17 [tied] (70 entries) Scheme User rank: 19 (69 entries) AWK User rank: 20 (66 entries) LUA User rank: 21 (62 entries) Common Lisp User rank: 22 (51 entries) X86 Assembly User rank: 23 [tied] (50 entries) Batch File User rank: 23 [tied] (50 entries) FORTH User rank: 25 [tied] (47 entries) Assembly User rank: 25 [tied] (47 entries) MATLAB User rank: 27 (45 entries) LISP User rank: 28 [tied] (40 entries) ADA User rank: 28 [tied] (40 entries) Delphi User rank: 28 [tied] (40 entries) Erlang User rank: 28 [tied] (40 entries) TCL User rank: 32 (39 entries) R User rank: 33 [tied] (38 entries) COBOL User rank: 33 [tied] (38 entries) Visual Basic .NET User rank: 35 [tied] (37 entries) APL User rank: 35 [tied] (37 entries) J User rank: 37 [tied] (36 entries) Objective-C User rank: 37 [tied] (36 entries) SmallTalk User rank: 39 (35 entries) Go User rank: 40 (34 entries) Brainf*** User rank: 41 [tied] (32 entries) Clojure User rank: 41 [tied] (32 entries) Mathematica User rank: 43 (30 entries) Raku User rank: 44 [tied] (29 entries) OCaml User rank: 44 [tied] (29 entries) REXX User rank: 46 (27 entries) PostScript User rank: 47 [tied] (26 entries) Emacs Lisp User rank: 47 [tied] (26 entries) LaTeX User rank: 47 [tied] (26 entries) Sed User rank: 50 (25 entries) AutoHotkey User rank: 51 [tied] (24 entries) 6502 Assembly User rank: 51 [tied] (24 entries) MySQL User rank: 53 [tied] (23 entries) Racket User rank: 53 [tied] (23 entries) Scala User rank: 53 [tied] (23 entries) VBScript User rank: 53 [tied] (23 entries) XSLT User rank: 57 (21 entries) 8086 Assembly User rank: 58 (20 entries) F Sharp User rank: 59 [tied] (19 entries) Rust User rank: 59 [tied] (19 entries) TI-83 BASIC User rank: 59 [tied] (19 entries) VBA User rank: 59 [tied] (19 entries) Z80 Assembly User rank: 63 [tied] (18 entries) Factor User rank: 63 [tied] (18 entries) Logo User rank: 63 [tied] (18 entries) Make User rank: 63 [tied] (18 entries) PowerShell User rank: 67 [tied] (17 entries) Apex User rank: 67 [tied] (17 entries) PL/I User rank: 67 [tied] (17 entries) Standard ML User rank: 67 [tied] (17 entries) Swift User rank: 71 [tied] (16 entries) D User rank: 71 [tied] (16 entries) Julia User rank: 71 [tied] (16 entries) Modula-2 User rank: 74 [tied] (15 entries) ARM Assembly User rank: 74 [tied] (15 entries) ActionScript User rank: 74 [tied] (15 entries) AppleScript User rank: 74 [tied] (15 entries) Icon User rank: 78 [tied] (14 entries) Maxima User rank: 78 [tied] (14 entries) SNOBOL4 User rank: 80 [tied] (13 entries) Befunge User rank: 80 [tied] (13 entries) CoffeeScript User rank: 80 [tied] (13 entries) Nim User rank: 83 [tied] (12 entries) 80386 Assembly User rank: 83 [tied] (12 entries) Euphoria User rank: 83 [tied] (12 entries) Unicon User rank: 86 [tied] (11 entries) Eiffel User rank: 86 [tied] (11 entries) Elixir User rank: 86 [tied] (11 entries) Groovy User rank: 86 [tied] (11 entries) Octave User rank: 86 [tied] (11 entries) PARI/GP User rank: 91 [tied] (10 entries) Dc User rank: 91 [tied] (10 entries) MIPS Assembly User rank: 91 [tied] (10 entries) PL/SQL User rank: 91 [tied] (10 entries) SAS User rank: 91 [tied] (10 entries) UnixPipes User rank: 96 [tied] (9 entries) AutoIt User rank: 96 [tied] (9 entries) BBC BASIC User rank: 96 [tied] (9 entries) JCL User rank: 96 [tied] (9 entries) M4 User rank: 96 [tied] (9 entries) Oz User rank: 96 [tied] (9 entries) Processing User rank: 96 [tied] (9 entries) REBOL User rank: 96 [tied] (9 entries) TypeScript User rank: 104 [tied] (8 entries) 68000 Assembly User rank: 104 [tied] (8 entries) Gnuplot User rank: 104 [tied] (8 entries) LabVIEW User rank: 104 [tied] (8 entries) POV-Ray User rank: 104 [tied] (8 entries) PicoLisp User rank: 109 [tied] (7 entries) ALGOL 68 User rank: 109 [tied] (7 entries) ASP User rank: 109 [tied] (7 entries) DCL User rank: 109 [tied] (7 entries) Liberty BASIC User rank: 109 [tied] (7 entries) MUMPS User rank: 109 [tied] (7 entries) Maple User rank: 109 [tied] (7 entries) Mercury User rank: 109 [tied] (7 entries) PDP-11 Assembly User rank: 109 [tied] (7 entries) PowerBASIC User rank: 109 [tied] (7 entries) PureBasic User rank: 109 [tied] (7 entries) Scratch User rank: 109 [tied] (7 entries) VHDL User rank: 121 [tied] (6 entries) Applesoft BASIC User rank: 121 [tied] (6 entries) Bc User rank: 121 [tied] (6 entries) ColdFusion User rank: 121 [tied] (6 entries) Commodore BASIC User rank: 121 [tied] (6 entries) Dart User rank: 121 [tied] (6 entries) HyperTalk User rank: 121 [tied] (6 entries) Io User rank: 121 [tied] (6 entries) Joy User rank: 121 [tied] (6 entries) Modula-3 User rank: 121 [tied] (6 entries) Pike User rank: 121 [tied] (6 entries) Self User rank: 121 [tied] (6 entries) Vim Script User rank: 133 [tied] (5 entries) 8080 Assembly User rank: 133 [tied] (5 entries) ABAP User rank: 133 [tied] (5 entries) ALGOL 60 User rank: 133 [tied] (5 entries) CMake User rank: 133 [tied] (5 entries) Clipper User rank: 133 [tied] (5 entries) FreeBASIC User rank: 133 [tied] (5 entries) GML User rank: 133 [tied] (5 entries) Haxe User rank: 133 [tied] (5 entries) Inform 7 User rank: 133 [tied] (5 entries) Integer BASIC User rank: 133 [tied] (5 entries) K User rank: 133 [tied] (5 entries) Kotlin User rank: 133 [tied] (5 entries) NSIS User rank: 133 [tied] (5 entries) NewLISP User rank: 133 [tied] (5 entries) Q User rank: 133 [tied] (5 entries) REALbasic User rank: 133 [tied] (5 entries) TI-89 BASIC User rank: 133 [tied] (5 entries) VB6 User rank: 133 [tied] (5 entries) Verilog User rank: 133 [tied] (5 entries) XQuery User rank: 153 [tied] (4 entries) 360 Assembly User rank: 153 [tied] (4 entries) BCPL User rank: 153 [tied] (4 entries) C Shell User rank: 153 [tied] (4 entries) FALSE User rank: 153 [tied] (4 entries) GAP User rank: 153 [tied] (4 entries) GolfScript User rank: 153 [tied] (4 entries) HQ9+ User rank: 153 [tied] (4 entries) Locomotive Basic User rank: 153 [tied] (4 entries) M680x0 User rank: 153 [tied] (4 entries) OoRexx User rank: 153 [tied] (4 entries) PIR User rank: 153 [tied] (4 entries) PlainTeX User rank: 153 [tied] (4 entries) PowerPC Assembly User rank: 153 [tied] (4 entries) QBASIC User rank: 153 [tied] (4 entries) Run BASIC User rank: 153 [tied] (4 entries) Scilab User rank: 153 [tied] (4 entries) TorqueScript User rank: 153 [tied] (4 entries) Vala User rank: 153 [tied] (4 entries) ZX Spectrum Basic User rank: 172 [tied] (3 entries) 6800 Assembly User rank: 172 [tied] (3 entries) ALGOL User rank: 172 [tied] (3 entries) ASP.Net User rank: 172 [tied] (3 entries) Dylan User rank: 172 [tied] (3 entries) Egison User rank: 172 [tied] (3 entries) Falcon User rank: 172 [tied] (3 entries) Fantom User rank: 172 [tied] (3 entries) Free Pascal User rank: 172 [tied] (3 entries) Frink User rank: 172 [tied] (3 entries) GW-BASIC User rank: 172 [tied] (3 entries) HLA User rank: 172 [tied] (3 entries) IDL User rank: 172 [tied] (3 entries) LFE User rank: 172 [tied] (3 entries) MMIX User rank: 172 [tied] (3 entries) N/t/roff User rank: 172 [tied] (3 entries) NetRexx User rank: 172 [tied] (3 entries) Nial User rank: 172 [tied] (3 entries) Oberon-2 User rank: 172 [tied] (3 entries) Object Pascal User rank: 172 [tied] (3 entries) Occam User rank: 172 [tied] (3 entries) PL/pgSQL User rank: 172 [tied] (3 entries) Pure User rank: 172 [tied] (3 entries) RPG User rank: 172 [tied] (3 entries) SPARC Assembly User rank: 172 [tied] (3 entries) SPARK User rank: 172 [tied] (3 entries) Sather User rank: 172 [tied] (3 entries) SequenceL User rank: 172 [tied] (3 entries) Shen User rank: 172 [tied] (3 entries) Snobol User rank: 172 [tied] (3 entries) Teco User rank: 172 [tied] (3 entries) Transact-SQL User rank: 172 [tied] (3 entries) VAX Assembly User rank: 172 [tied] (3 entries) Wolfram Language User rank: 172 [tied] (3 entries) X86-64 Assembly User rank: 172 [tied] (3 entries) Xojo User rank: 207 [tied] (2 entries) Agena User rank: 207 [tied] (2 entries) Alice ML User rank: 207 [tied] (2 entries) AmigaE User rank: 207 [tied] (2 entries) AspectJ User rank: 207 [tied] (2 entries) BASIC256 User rank: 207 [tied] (2 entries) BaCon User rank: 207 [tied] (2 entries) Basic09 User rank: 207 [tied] (2 entries) Bracmat User rank: 207 [tied] (2 entries) Burlesque User rank: 207 [tied] (2 entries) C++/CLI User rank: 207 [tied] (2 entries) CHR User rank: 207 [tied] (2 entries) CLIPS User rank: 207 [tied] (2 entries) Caché ObjectScript User rank: 207 [tied] (2 entries) Casio BASIC User rank: 207 [tied] (2 entries) Chef User rank: 207 [tied] (2 entries) Coq User rank: 207 [tied] (2 entries) Crystal User rank: 207 [tied] (2 entries) DWScript User rank: 207 [tied] (2 entries) E User rank: 207 [tied] (2 entries) ELM User rank: 207 [tied] (2 entries) Elena User rank: 207 [tied] (2 entries) Fancy User rank: 207 [tied] (2 entries) Fish User rank: 207 [tied] (2 entries) Friendly interactive shell User rank: 207 [tied] (2 entries) GFA Basic User rank: 207 [tied] (2 entries) Gambas User rank: 207 [tied] (2 entries) Gema User rank: 207 [tied] (2 entries) Glee User rank: 207 [tied] (2 entries) Harbour User rank: 207 [tied] (2 entries) JavaFX Script User rank: 207 [tied] (2 entries) Jq User rank: 207 [tied] (2 entries) Limbo User rank: 207 [tied] (2 entries) LiveCode User rank: 207 [tied] (2 entries) Logtalk User rank: 207 [tied] (2 entries) Lush User rank: 207 [tied] (2 entries) MIRC Scripting Language User rank: 207 [tied] (2 entries) MK-61/52 User rank: 207 [tied] (2 entries) Metafont User rank: 207 [tied] (2 entries) Neko User rank: 207 [tied] (2 entries) NetLogo User rank: 207 [tied] (2 entries) Openscad User rank: 207 [tied] (2 entries) Pentium Assembly User rank: 207 [tied] (2 entries) Picat User rank: 207 [tied] (2 entries) Piet User rank: 207 [tied] (2 entries) Plain English User rank: 207 [tied] (2 entries) Processing Python mode User rank: 207 [tied] (2 entries) Quackery User rank: 207 [tied] (2 entries) RLaB User rank: 207 [tied] (2 entries) RPGIV User rank: 207 [tied] (2 entries) RPL User rank: 207 [tied] (2 entries) Refal User rank: 207 [tied] (2 entries) S-lang User rank: 207 [tied] (2 entries) SETL User rank: 207 [tied] (2 entries) SNUSP User rank: 207 [tied] (2 entries) SPSS User rank: 207 [tied] (2 entries) Sage User rank: 207 [tied] (2 entries) Seed7 User rank: 207 [tied] (2 entries) Simula User rank: 207 [tied] (2 entries) Stata User rank: 207 [tied] (2 entries) SystemVerilog User rank: 207 [tied] (2 entries) TXR User rank: 207 [tied] (2 entries) UserRPL User rank: 207 [tied] (2 entries) Whitespace User rank: 207 [tied] (2 entries) XBase User rank: 207 [tied] (2 entries) XUL User rank: 207 [tied] (2 entries) Yorick User rank: 207 [tied] (2 entries) Zig User rank: 274 [tied] (1 entry) .QL User rank: 274 [tied] (1 entry) 4D User rank: 274 [tied] (1 entry) 4DOS Batch User rank: 274 [tied] (1 entry) 8051 Assembly User rank: 274 [tied] (1 entry) A+ User rank: 274 [tied] (1 entry) AARCH64 Assembly User rank: 274 [tied] (1 entry) ACL2 User rank: 274 [tied] (1 entry) AMPL User rank: 274 [tied] (1 entry) ANT User rank: 274 [tied] (1 entry) Agda User rank: 274 [tied] (1 entry) AmbientTalk User rank: 274 [tied] (1 entry) AngelScript User rank: 274 [tied] (1 entry) Application Master User rank: 274 [tied] (1 entry) Arc User rank: 274 [tied] (1 entry) Arturo User rank: 274 [tied] (1 entry) Astro User rank: 274 [tied] (1 entry) B User rank: 274 [tied] (1 entry) B4J User rank: 274 [tied] (1 entry) Beeswax User rank: 274 [tied] (1 entry) Biferno User rank: 274 [tied] (1 entry) Blast User rank: 274 [tied] (1 entry) BlitzMax User rank: 274 [tied] (1 entry) Brace User rank: 274 [tied] (1 entry) Brat User rank: 274 [tied] (1 entry) Brlcad User rank: 274 [tied] (1 entry) C0H User rank: 274 [tied] (1 entry) CB80 User rank: 274 [tied] (1 entry) COMAL User rank: 274 [tied] (1 entry) Caml User rank: 274 [tied] (1 entry) Cat User rank: 274 [tied] (1 entry) Chapel User rank: 274 [tied] (1 entry) Cilk++ User rank: 274 [tied] (1 entry) Clay User rank: 274 [tied] (1 entry) Comefrom0x10 User rank: 274 [tied] (1 entry) Curry User rank: 274 [tied] (1 entry) DIBOL-11 User rank: 274 [tied] (1 entry) DIV Games Studio User rank: 274 [tied] (1 entry) DM User rank: 274 [tied] (1 entry) DUP User rank: 274 [tied] (1 entry) Dafny User rank: 274 [tied] (1 entry) Dao User rank: 274 [tied] (1 entry) Dylan.NET User rank: 274 [tied] (1 entry) Déjà Vu User rank: 274 [tied] (1 entry) ECL User rank: 274 [tied] (1 entry) EDSAC order code User rank: 274 [tied] (1 entry) EGL User rank: 274 [tied] (1 entry) EchoLisp User rank: 274 [tied] (1 entry) Es User rank: 274 [tied] (1 entry) FBSL User rank: 274 [tied] (1 entry) FP User rank: 274 [tied] (1 entry) FUZE BASIC User rank: 274 [tied] (1 entry) Felix User rank: 274 [tied] (1 entry) Fermat User rank: 274 [tied] (1 entry) Fexl User rank: 274 [tied] (1 entry) Frege User rank: 274 [tied] (1 entry) Furor User rank: 274 [tied] (1 entry) Futhark User rank: 274 [tied] (1 entry) FutureBasic User rank: 274 [tied] (1 entry) Fôrmulæ User rank: 274 [tied] (1 entry) GLSL User rank: 274 [tied] (1 entry) GUISS User rank: 274 [tied] (1 entry) Genie User rank: 274 [tied] (1 entry) Global Script User rank: 274 [tied] (1 entry) Gosu User rank: 274 [tied] (1 entry) HPPPL User rank: 274 [tied] (1 entry) Hack User rank: 274 [tied] (1 entry) Hexiscript User rank: 274 [tied] (1 entry) HolyC User rank: 274 [tied] (1 entry) Hope User rank: 274 [tied] (1 entry) Huginn User rank: 274 [tied] (1 entry) I User rank: 274 [tied] (1 entry) Inform 6 User rank: 274 [tied] (1 entry) Informix 4GL User rank: 274 [tied] (1 entry) Ioke User rank: 274 [tied] (1 entry) JOVIAL User rank: 274 [tied] (1 entry) JoCaml User rank: 274 [tied] (1 entry) Jsish User rank: 274 [tied] (1 entry) KL1 User rank: 274 [tied] (1 entry) Kabap User rank: 274 [tied] (1 entry) Kamailio Script User rank: 274 [tied] (1 entry) KeyList Databasing User rank: 274 [tied] (1 entry) Kite User rank: 274 [tied] (1 entry) Klong User rank: 274 [tied] (1 entry) KonsolScript User rank: 274 [tied] (1 entry) L.in.oleum User rank: 274 [tied] (1 entry) LC3 Assembly User rank: 274 [tied] (1 entry) LIL User rank: 274 [tied] (1 entry) LLVM User rank: 274 [tied] (1 entry) LOLCODE User rank: 274 [tied] (1 entry) LSL User rank: 274 [tied] (1 entry) Lambda Prolog User rank: 274 [tied] (1 entry) Lang5 User rank: 274 [tied] (1 entry) Lhogho User rank: 274 [tied] (1 entry) LibreOffice Basic User rank: 274 [tied] (1 entry) Lilypond User rank: 274 [tied] (1 entry) LiveScript User rank: 274 [tied] (1 entry) Lotus 123 Macro Scripting User rank: 274 [tied] (1 entry) Lucid User rank: 274 [tied] (1 entry) M2000 Interpreter User rank: 274 [tied] (1 entry) MACRO-11 User rank: 274 [tied] (1 entry) MANOOL User rank: 274 [tied] (1 entry) MAPPER User rank: 274 [tied] (1 entry) MBS User rank: 274 [tied] (1 entry) MDL User rank: 274 [tied] (1 entry) ME10 macro User rank: 274 [tied] (1 entry) MINIL User rank: 274 [tied] (1 entry) ML User rank: 274 [tied] (1 entry) ML/I User rank: 274 [tied] (1 entry) MLite User rank: 274 [tied] (1 entry) MOO User rank: 274 [tied] (1 entry) MUF User rank: 274 [tied] (1 entry) Malbolge User rank: 274 [tied] (1 entry) Mathcad User rank: 274 [tied] (1 entry) Metapost User rank: 274 [tied] (1 entry) Microsoft Small Basic User rank: 274 [tied] (1 entry) MiniScript User rank: 274 [tied] (1 entry) MiniZinc User rank: 274 [tied] (1 entry) NASL User rank: 274 [tied] (1 entry) Nanoquery User rank: 274 [tied] (1 entry) Neat User rank: 274 [tied] (1 entry) Nemerle User rank: 274 [tied] (1 entry) Never User rank: 274 [tied] (1 entry) Niue User rank: 274 [tied] (1 entry) OOCalc User rank: 274 [tied] (1 entry) Objeck User rank: 274 [tied] (1 entry) Ol User rank: 274 [tied] (1 entry) OpenC++ User rank: 274 [tied] (1 entry) OpenEdge/Progress User rank: 274 [tied] (1 entry) Order User rank: 274 [tied] (1 entry) PHL User rank: 274 [tied] (1 entry) PL/M User rank: 274 [tied] (1 entry) PLUS User rank: 274 [tied] (1 entry) PLZ/SYS User rank: 274 [tied] (1 entry) PPL User rank: 274 [tied] (1 entry) Peloton User rank: 274 [tied] (1 entry) PeopleCode User rank: 274 [tied] (1 entry) Perl5i User rank: 274 [tied] (1 entry) Phix User rank: 274 [tied] (1 entry) Pop11 User rank: 274 [tied] (1 entry) Powerbuilder User rank: 274 [tied] (1 entry) Pure Data User rank: 274 [tied] (1 entry) Pyret User rank: 274 [tied] (1 entry) Quite BASIC User rank: 274 [tied] (1 entry) Ratfor User rank: 274 [tied] (1 entry) Reason User rank: 274 [tied] (1 entry) Relation User rank: 274 [tied] (1 entry) Retro User rank: 274 [tied] (1 entry) Risc-V User rank: 274 [tied] (1 entry) Robotic User rank: 274 [tied] (1 entry) SASL User rank: 274 [tied] (1 entry) SIMPOL User rank: 274 [tied] (1 entry) SQL PL User rank: 274 [tied] (1 entry) Salmon User rank: 274 [tied] (1 entry) SenseTalk User rank: 274 [tied] (1 entry) Set lang User rank: 274 [tied] (1 entry) Shale User rank: 274 [tied] (1 entry) Sidef User rank: 274 [tied] (1 entry) Sinclair ZX81 BASIC User rank: 274 [tied] (1 entry) SkookumScript User rank: 274 [tied] (1 entry) Slate User rank: 274 [tied] (1 entry) Smart BASIC User rank: 274 [tied] (1 entry) Sparkling User rank: 274 [tied] (1 entry) Spin User rank: 274 [tied] (1 entry) Suneido User rank: 274 [tied] (1 entry) SuperTalk User rank: 274 [tied] (1 entry) Superbase BASIC User rank: 274 [tied] (1 entry) TAL User rank: 274 [tied] (1 entry) TMG User rank: 274 [tied] (1 entry) TPP User rank: 274 [tied] (1 entry) TUSCRIPT User rank: 274 [tied] (1 entry) Tailspin User rank: 274 [tied] (1 entry) TechBASIC User rank: 274 [tied] (1 entry) Thistle User rank: 274 [tied] (1 entry) Thyrd User rank: 274 [tied] (1 entry) Tiny BASIC User rank: 274 [tied] (1 entry) Toka User rank: 274 [tied] (1 entry) Trith User rank: 274 [tied] (1 entry) True BASIC User rank: 274 [tied] (1 entry) Uniface User rank: 274 [tied] (1 entry) Unlambda User rank: 274 [tied] (1 entry) Ursa User rank: 274 [tied] (1 entry) Ursala User rank: 274 [tied] (1 entry) V User rank: 274 [tied] (1 entry) Vedit macro language User rank: 274 [tied] (1 entry) Viua VM assembly User rank: 274 [tied] (1 entry) WDTE User rank: 274 [tied] (1 entry) WML User rank: 274 [tied] (1 entry) Wart User rank: 274 [tied] (1 entry) WebAssembly User rank: 274 [tied] (1 entry) Whenever User rank: 274 [tied] (1 entry) Wisp User rank: 274 [tied] (1 entry) XLISP User rank: 274 [tied] (1 entry) XPL0 User rank: 274 [tied] (1 entry) XProc User rank: 274 [tied] (1 entry) XTalk User rank: 274 [tied] (1 entry) Yacas User rank: 274 [tied] (1 entry) ZED User rank: 274 [tied] (1 entry) ZPL User rank: 274 [tied] (1 entry) Zkl User rank: 274 [tied] (1 entry) Zoea User rank: 274 [tied] (1 entry) µC++ User ☼ end─of─list. ☼
Stata
<lang stata>copy "http://rosettacode.org/mw/index.php?title=Special:Categories&limit=5000" categ.html, replace import delimited categ.html, delim("@") enc("utf-8") clear keep if ustrpos(v1,"/wiki/Category:") & ustrpos(v1,"_User") gen i = ustrpos(v1,"href=") gen j = ustrpos(v1,char(34),i+1) gen k = ustrpos(v1,char(34),j+1) gen s = usubstr(v1,j+7,k-j-7) replace i = ustrpos(v1,"title=") replace j = ustrpos(v1,">",i+1) replace k = ustrpos(v1," User",j+1) gen lang = usubstr(v1,j+1,k-j) keep s lang gen users=.
forval i=1/`c(N)' { local s preserve copy `"https://rosettacode.org/mw/index.php?title=`=s[`i']'&redirect=no"' `i'.html, replace import delimited `i'.html, delim("@") enc("utf-8") clear count if ustrpos(v1,"/wiki/User") local m `r(N)' restore replace users=`m' in `i' erase `i'.html }
drop s gsort -users lang compress leftalign list in f/50 save rc_users, replace</lang>
Output (2019-02-18)
+----------------------------+ | lang users | |----------------------------| 1. | C 391 | 2. | Java 276 | 3. | C++ 275 | 4. | Python 262 | 5. | JavaScript 238 | |----------------------------| 6. | Perl 171 | 7. | PHP 167 | 8. | SQL 138 | 9. | UNIX Shell 131 | 10. | BASIC 120 | |----------------------------| 11. | C sharp 118 | 12. | Pascal 116 | 13. | Haskell 102 | 14. | Ruby 93 | 15. | Fortran 79 | |----------------------------| 16. | Visual Basic 68 | 17. | Prolog 65 | 18. | Scheme 61 | 19. | Common Lisp 58 | 20. | AWK 57 | |----------------------------| 21. | Lua 57 | 22. | HTML 52 | 23. | Assembly 45 | 24. | Batch File 44 | 25. | X86 Assembly 44 | |----------------------------| 26. | Bash 43 | 27. | Erlang 40 | 28. | Lisp 39 | 29. | MATLAB 39 | 30. | Forth 38 | |----------------------------| 31. | Ada 36 | 32. | Visual Basic .NET 36 | 33. | Delphi 35 | 34. | J 35 | 35. | APL 34 | |----------------------------| 36. | Brainf*** 34 | 37. | Tcl 34 | 38. | Objective-C 33 | 39. | Smalltalk 33 | 40. | COBOL 32 | |----------------------------| 41. | R 32 | 42. | Go 30 | 43. | Mathematica 30 | 44. | Perl 6 29 | 45. | Clojure 27 | |----------------------------| 46. | AutoHotkey 25 | 47. | REXX 25 | 48. | LaTeX 23 | 49. | OCaml 23 | 50. | Sed 23 | +----------------------------+
zkl
Uses libraries cURL and YAJL (yet another json library) <lang zkl>const MIN_USERS=60; var [const] CURL=Import("zklCurl"), YAJL=Import("zklYAJL")[0];
fcn rsGet{
continueValue,r,curl := "",List, CURL(); do{ // eg 5 times page:=("http://rosettacode.org/mw/api.php?action=query" "&generator=categorymembers&prop=categoryinfo"
"&gcmtitle=Category%%3ALanguage%%20users" "&rawcontinue=&format=json&gcmlimit=350" "%s").fmt(continueValue);
page=curl.get(page); page=page[0].del(0,page[1]); // get rid of HTML header json:=YAJL().write(page).close(); json["query"]["pages"].pump(r.append,'wrap(x){ x=x[1]; //("2708",Dictionary(title:Category:C User,...,categoryinfo:D(pages:373,size:373,...)))
// or title:SmartBASIC if((pgs:=x.find("categoryinfo")) and (pgs=pgs.find("pages")) and pgs>=MIN_USERS) return(pgs,x["title"].replace("Category:","").replace(" User","")); return(Void.Skip);
}); if(continueValue=json.find("query-continue","")) continueValue=String("&gcmcontinue=",
continueValue["categorymembers"]["gcmcontinue"]);
}while(continueValue); r
}
allLangs:=rsGet(); allLangs=allLangs.sort(fcn(a,b){ a[0]>b[0] }); println("========== ",Time.Date.prettyDay()," =========="); foreach n,pgnm in ([1..].zip(allLangs))
{ println("#%3d with %4s users: %s".fmt(n,pgnm.xplode())) }</lang>
- Output:
========== Wednesday, the 20th of December 2017 ========== # 1 with 373 users: C # 2 with 261 users: C++ # 3 with 257 users: Java # 4 with 243 users: Python # 5 with 228 users: JavaScript # 6 with 163 users: PHP # 7 with 162 users: Perl # 8 with 131 users: SQL # 9 with 120 users: UNIX Shell # 10 with 118 users: BASIC # 11 with 113 users: C sharp # 12 with 109 users: Pascal # 13 with 98 users: Haskell # 14 with 91 users: Ruby # 15 with 71 users: Fortran # 16 with 65 users: Visual Basic # 17 with 60 users: Scheme