Rosetta Code/Rank languages by number of users: Difference between revisions

Content added Content deleted
(Updated URL from ""http://rosettacode.org/mw/api.php?" to ""http://rosettacode.org/w/api.php?". Updated output.)
m (→‎{{header|Wren}}: Minor tidy)
Line 2,004: Line 2,004:


We can in fact get all the information needed for this task just by parsing the 'Special:Categories' page. Note however that the HTML for this page contains some invisible Unicode right-to-left and left-to-right characters - a well known security risk but apparently harmless here - which need to be allowed for when extracting the number of users.
We can in fact get all the information needed for this task just by parsing the 'Special:Categories' page. Note however that the HTML for this page contains some invisible Unicode right-to-left and left-to-right characters - a well known security risk but apparently harmless here - which need to be allowed for when extracting the number of users.
<syntaxhighlight lang="ecmascript">/* rc_rank_languages_by_number_of_users.wren */
<syntaxhighlight lang="wren">/* Rosetta_Code_Rank_languages_by_number_of_users.wren */


import "./pattern" for Pattern
import "./pattern" for Pattern
Line 2,055: Line 2,055:
}
}
over100s.sort { |a, b| a[1] > b[1] }
over100s.sort { |a, b| a[1] > b[1] }
System.print("Languages with at least 100 users as at 4 January, 2022:")
System.print("Languages with at least 100 users as at 3 February, 2024:")
var rank = 0
var rank = 0
var lastScore = 0
var lastScore = 0
Line 2,074: Line 2,074:
<br>
<br>
We now embed this script in the following C program, build and run.
We now embed this script in the following C program, build and run.
<syntaxhighlight lang="c">/* gcc rc_rank_languages_by_number_of_users.c -o rc_rank_languages_by_number_of_users -lcurl -lwren -lm */
<syntaxhighlight lang="c">/* gcc Rosetta_Code_Rank_languages_by_number_of_users.c -o Rosetta_Code_Rank_languages_by_number_of_users -lcurl -lwren -lm */


#include <stdio.h>
#include <stdio.h>
Line 2,248: Line 2,248:
WrenVM* vm = wrenNewVM(&config);
WrenVM* vm = wrenNewVM(&config);
const char* module = "main";
const char* module = "main";
const char* fileName = "rc_rank_languages_by_number_of_users.wren";
const char* fileName = "Rosetta_Code_Rank_languages_by_number_of_users.wren";
char *script = readFile(fileName);
char *script = readFile(fileName);
WrenInterpretResult result = wrenInterpret(vm, module, script);
WrenInterpretResult result = wrenInterpret(vm, module, script);
Line 2,268: Line 2,268:
{{out}}
{{out}}
<pre>
<pre>
Languages with at least 100 users as at 9 September, 2022:
Languages with at least 100 users as at 3 February, 2024:
1 C 441
1 C 434
2 Java 321
2 Java 326
3 Python 319
3 Python 323
4 C++ 314
4 C++ 306
5 JavaScript 291
5 JavaScript 287
6 PHP 190
6 PHP 188
7 Perl 186
7 Perl 181
8 SQL 167
8 SQL 166
9 UNIX Shell 151
9 UNIX Shell 146
10 Pascal 133
10 Pascal 128
11 BASIC 132
10= BASIC 128
11= C sharp 132
12 C sharp 124
13 Haskell 115
13 Haskell 107
14 Ruby 107
14 Ruby 101
</pre>
</pre>