Rosetta Code/Rank languages by number of users: Difference between revisions
Rosetta Code/Rank languages by number of users (view source)
Revision as of 17:26, 3 February 2024
, 5 months ago→{{header|Wren}}: Minor tidy
(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:
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="
import "./pattern" for Pattern
Line 2,055:
}
over100s.sort { |a, b| a[1] > b[1] }
System.print("Languages with at least 100 users as at
var rank = 0
var lastScore = 0
Line 2,074:
<br>
We now embed this script in the following C program, build and run.
<syntaxhighlight lang="c">/* gcc
#include <stdio.h>
Line 2,248:
WrenVM* vm = wrenNewVM(&config);
const char* module = "main";
const char* fileName = "
char *script = readFile(fileName);
WrenInterpretResult result = wrenInterpret(vm, module, script);
Line 2,268:
{{out}}
<pre>
Languages with at least 100 users as at
1 C
2 Java
3 Python
4 C++
5 JavaScript
6 PHP
7 Perl
8 SQL
9 UNIX Shell
10 Pascal
13 Haskell
14 Ruby
</pre>
|