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=" |
<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 |
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 |
<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 = " |
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 |
Languages with at least 100 users as at 3 February, 2024: |
||
1 C |
1 C 434 |
||
2 Java |
2 Java 326 |
||
3 Python |
3 Python 323 |
||
4 C++ |
4 C++ 306 |
||
5 JavaScript |
5 JavaScript 287 |
||
6 PHP |
6 PHP 188 |
||
7 Perl |
7 Perl 181 |
||
8 SQL |
8 SQL 166 |
||
9 UNIX Shell |
9 UNIX Shell 146 |
||
10 Pascal |
10 Pascal 128 |
||
10= BASIC 128 |
|||
12 C sharp 124 |
|||
13 Haskell |
13 Haskell 107 |
||
14 Ruby |
14 Ruby 101 |
||
</pre> |
</pre> |
||