Rosetta Code/List authors of task descriptions: Difference between revisions

m
(=={{header|Perl 6}}== Convert output table to a sortable wiki-table, rearrange and tweak code a bit.)
m (→‎{{header|Wren}}: Minor tidy)
 
(27 intermediate revisions by 6 users not shown)
Line 1:
{{draft task}}In this task, the goal is to compile an authorship list for task descriptions. A pseudocode example (in imperative style) that should accomplish this is as follows:
 
<langsyntaxhighlight lang="pseudocode">for each task page
grab page source, discard everything after the first ==section==.
Cache as $previous. Note $author.
Line 9:
compare $previous2 to $previous. If different, record $author to $list.
replace $previous with $previous2
replace $author with $author2</langsyntaxhighlight>
 
The following resources for HTTP interface information for MediaWiki may prove to be useful:
Line 19:
 
 
Please '''DO NOT''' add a full output for ''each'' programming language; just show a representative sample. OneFor full list is useful. Multiplean full lists just use spacelisting, andsee bandwidth[[Rosetta_Code/List_authors_of_task_descriptions/Full_list]].
 
=={{header|Go}}==
<div style="height:80ex;overflow:scroll;border-style:ridge;padding-left:2em;">
<syntaxhighlight lang="go">package main
{|class="wikitable"
 
|+ As of 2018-03-31 :: Total Tasks: 1080:: Tasks: 871 :: Draft Tasks: 209
import (
! Author !! Authored
"fmt"
"io/ioutil"
"net/http"
"regexp"
"sort"
"strings"
)
 
type authorNumber struct {
author string
number int
}
 
func main() {
ex1 := `<li><a href="/wiki/(.*?)"`
ex2 := `a href="/(wiki/User:|mw/index\.php\?title=User:|wiki/Special:Contributions/)([^"&]+)`
re1 := regexp.MustCompile(ex1)
re2 := regexp.MustCompile(ex2)
url1 := "http://rosettacode.org/wiki/Category:Programming_Tasks"
url2 := "http://rosettacode.org/wiki/Category:Draft_Programming_Tasks"
urls := []string{url1, url2}
var tasks []string
for _, url := range urls {
resp, _ := http.Get(url)
body, _ := ioutil.ReadAll(resp.Body)
// find all tasks
matches := re1.FindAllStringSubmatch(string(body), -1)
resp.Body.Close()
for _, match := range matches {
// exclude any 'category' references
if !strings.HasPrefix(match[1], "Category:") {
tasks = append(tasks, match[1])
}
}
}
authors := make(map[string]int)
for _, task := range tasks {
// check the last or only history page for each task
page := fmt.Sprintf("http://rosettacode.org/mw/index.php?title=%s&dir=prev&action=history", task)
resp, _ := http.Get(page)
body, _ := ioutil.ReadAll(resp.Body)
// find all the users in that page
matches := re2.FindAllStringSubmatch(string(body), -1)
resp.Body.Close()
// the task author should be the final user on that page
author := matches[len(matches)-1][2]
author = strings.ReplaceAll(author, "_", " ")
// add this task to the author's count
authors[author]++
}
// sort the authors in descending order by number of tasks created
authorNumbers := make([]authorNumber, 0, len(authors))
for k, v := range authors {
authorNumbers = append(authorNumbers, authorNumber{k, v})
}
sort.Slice(authorNumbers, func(i, j int) bool {
return authorNumbers[i].number > authorNumbers[j].number
})
// print the top twenty say
fmt.Println("Total tasks :", len(tasks))
fmt.Println("Total authors :", len(authors))
fmt.Println("\nThe top 20 authors by number of tasks created are:\n")
fmt.Println("Pos Tasks Author")
fmt.Println("=== ===== ======")
lastNumber, lastIndex := 0, -1
for i, authorNumber := range authorNumbers[0:20] {
j := i
if authorNumber.number == lastNumber {
j = lastIndex
} else {
lastIndex = i
lastNumber = authorNumber.number
}
fmt.Printf("%2d: %3d %s\n", j+1, authorNumber.number, authorNumber.author)
}
}</syntaxhighlight>
 
{{out}}
As of 5th March 2020:
<pre>
Total tasks : 1237
Total authors : 287
 
The top 20 authors by number of tasks created are:
 
Pos Tasks Author
=== ===== ======
1: 178 Paddy3118
2: 71 Markhobley
3: 61 Gerard Schildberger
4: 55 Mwn3d
5: 39 NevilleDNZ
6: 33 Short Circuit
7: 30 Nigel Galloway
8: 29 Thundergnat
9: 23 Grondilu
10: 21 Dkf
11: 20 Fwend
11: 20 Blue Prawn
13: 19 CalmoSoft
14: 18 Kernigh
15: 17 ShinTakezou
15: 17 Dmitry-kazakov
15: 17 Ledrug
18: 13 Abu
18: 13 Paulo Jorente
18: 13 Waldorf
</pre>
 
=={{header|Julia}}==
<syntaxhighlight lang="julia">""" Rosetta code task rosettacode.org/wiki/Rosetta_Code/List_authors_of_task_descriptions """
 
using Dates
using DataFrames
using EzXML
using HTTP
using JSON3
 
""" Get Rosetta Code authors of tasks, output as dataframe """
function rosetta_code_authors(verbose = false)
URL = "https://rosettacode.org/w/api.php?"
PARAMS = ["action" => "query", "format" => "json", "formatversion" => "2", "generator" => "categorymembers",
"gcmtitle" => "Category:Programming_Tasks", "gcmlimit" => "500", "rawcontinue" => "", "prop" => "title"]
DRAFTPARAMS = ["action" => "query", "format" => "json", "formatversion" => "2", "generator" => "categorymembers",
"gcmtitle" => "Category:Draft_Programming_Tasks", "gcmlimit" => "500", "rawcontinue" => "", "prop" => "title"]
 
titles = Pair{String, Bool}[]
dateformat = DateFormat("HH:SS, d U y")
df = empty!(DataFrame([[""], [""], [now()], [true]], ["Author", "Title", "CreationDate", "IsDraftTask"]))
 
for param in [PARAMS, DRAFTPARAMS] # get the titles of the tasks and draft tasks, store list in alltasks
continueposition = ""
queryparams = copy(param)
isdraft = param == DRAFTPARAMS
while true
resp = HTTP.get(URL * join(map(p -> p[1] * (p[2] == "" ? "" : ("=" * p[2])), queryparams), "&"))
json = JSON3.read(String(resp.body))
pages = json.query.pages
for p in pages
push!(titles, p.title => isdraft)
end
!haskey(json, "query-continue") && break # break if no more pages, else continue to next pages
queryparams = vcat(param, "gcmcontinue" => json["query-continue"]["categorymembers"]["gcmcontinue"])
end
end
 
 
for (i, title) in pairs(titles) # Get author of first revision of each page, assumed to be task creator/author
resp = HTTP.get("https://rosettacode.org/w/index.php?title=" * escape(title[1]) * "&dir=prev&action=history")
html = root(parsehtml(String(resp.body)))
xpath = "//span[@class=\"history-user\"]/a"
header = findlast(xpath, html)
author = header != nothing ? nodecontent(header) : ""
xpath2 = "//a[@class=\"mw-changeslist-date\"]"
header2 = findlast(xpath2, html)
creationdate = header2 != nothing ? DateTime(nodecontent(header2), dateformat) : missing
if author != ""
author = replace(author, r".+>" => "") # clean up from the hosting change
push!(df, [author, title[1], creationdate, title[2]])
verbose && println("Processed author $author of $title created $creationdate: page $i of ", length(titles))
end
end
sort!(df, :CreationDate, rev = true)
authorfreqs = sort!(combine(groupby(df, :Author), nrow => :Freq), :Freq, rev = true)
return df, authorfreqs
end
 
rosetta_code_authors()
</syntaxhighlight>{{out}}
<pre>
(1569×4 DataFrame
Row │ Author Title CreationDate IsDraftTask
│ String String DateTime Bool
──────┼───────────────────────────────────────────────────────────────────────────────────
1 │ Markjreed Sieve of Pritchard 2022-08-25T19:00:09 false
2 │ Thundergnat Penta-power prime seeds 2022-08-19T20:00:59 true
3 │ Thundergnat Quad-power prime seeds 2022-08-19T20:00:23 true
4 │ Thundergnat Riordan numbers 2022-08-18T18:00:20 true
5 │ Thundergnat Pairs with common factors 2022-08-18T12:00:07 true
6 │ Thundergnat Klarner-Rado sequence 2022-08-17T22:00:36 true
⋮ │ ⋮ ⋮ ⋮ ⋮
1564 │ Created by: X Determine if a string is numeric 2007-01-21T19:00:47 false
1565 │ MikeMol Empty program 2007-01-18T15:00:11 false
1566 │ 207.74.29.206 Window creation 2007-01-15T19:00:41 false
1567 │ MikeMol Table creation 2007-01-14T20:00:07 true
1568 │ MikeMol Hello world/Text 2007-01-09T16:00:45 false
1569 │ MikeMol File input/output 2007-01-09T14:00:45 false
1557 rows omitted,
315×2 DataFrame
Row │ Author Freq
│ String Int64
─────┼────────────────────────────
1 │ Paddy3118 199
2 │ CalmoSoft 135
3 │ Thundergnat 74
4 │ Markhobley 71
5 │ Gerard Schildberger 66
6 │ Mwn3d 55
⋮ │ ⋮ ⋮
310 │ Til 1
311 │ Backupbrain 1
312 │ Fabian 1
313 │ Vcelier 1
314 │ Created by: X 1
315 │ 207.74.29.206 1
303 rows omitted)
</pre>
 
=={{header|Nim}}==
{{trans|Go}}
<syntaxhighlight lang="nim">import algorithm, httpclient, re, strutils, tables
 
let
re1 = re("""<li><a href="/wiki/(.*?)"""")
re2 = re("""a href="/wiki/User:|mw/index\.php\?title=User:|wiki/Special:Contributions/([^"&]+)""")
 
const
Url1 = "http://rosettacode.org/wiki/Category:Programming_Tasks"
Url2 = "http://rosettacode.org/wiki/Category:Draft_Programming_Tasks"
Urls = [Url1, Url2]
 
var client = newHttpClient()
 
var tasks: seq[string]
var matches: array[1, string]
var start = 0
for url in Urls:
let body = client.getContent(url)
# Find all tasks.
while true:
start = body.find(re1, matches, start) + 1
if start == 0: break
if not matches[0].startsWith("Category:"):
tasks.add matches[0]
 
var authors: CountTable[string]
for task in tasks:
# Check the last or only history page for each task.
let page = "http://rosettacode.org/mw/index.php?title=$#&dir=prev&action=history".format(task)
let body = client.getContent(page)
# Find all the users in that page. The task author should be the final user on that page.
var matches: array[1, string]
start = 0
while true:
start = body.find(re2, matches, start) + 1
if start == 0: break
let author = matches[0].replace('-', ' ')
# Add this task to the author's count.
authors.inc(author)
 
# Sort the authors in descending order by number of tasks created.
authors.sort(Descending)
 
# Print the top twenty.
echo "Total tasks: ", tasks.len
echo "Total authors: ", authors.len
echo "\nThe top 20 authors by number of tasks created are:\n"
echo "Pos Tasks Author"
echo "=== ===== ======"
var pos = 0
for author, count in authors.pairs:
inc pos
echo ($pos).align(2), " ", ($count).align(3), " ", author
if pos == 20: break</syntaxhighlight>
 
{{out}}
On 2021-06-29.
<pre>The top 20 authors by number of tasks created are:
 
Pos Tasks Author
=== ===== ======
1 196 Paddy3118
2 84 CalmoSoft
3 72 Markhobley
4 66 Gerard_Schildberger
5 55 Mwn3d
6 39 NevilleDNZ
7 39 Thundergnat
8 33 Nigel_Galloway
9 33 Short_Circuit
10 23 Grondilu
11 21 Blue_Prawn
12 20 Fwend
13 20 Dkf
14 18 Kernigh
15 17 Ledrug
16 17 ShinTakezou
17 17 Dmitry kazakov
18 14 Wherrera
19 13 Waldorf
20 13 Abu</pre>
 
=={{header|Phix}}==
To keep the output nice and short, lists the top 5 task creators.<br>
Uses a cache: once a .hist file has been downloaded for a given
task, it is assumed to be good forever. Each task is about 20K,
so it will download around 25MB in total, for >= 1,219 tasks.
It does those sequentially, using curl_easy_ handles. I guess
if you really wanted to then using curl_multi_ handles would
properly thrash the rosettacode servers.
{{libheader|Phix/libcurl}}
<!--<syntaxhighlight lang="phix">(notonline)-->
<span style="color: #000080;font-style:italic;">-- demo\rosetta\List_task_authors.exw</span>
<span style="color: #008080;">without</span> <span style="color: #008080;">js</span> <span style="color: #000080;font-style:italic;">-- (libcurl, file i/o, peek, progress..)</span>
<span style="color: #008080;">include</span> <span style="color: #000000;">rosettacode_cache</span><span style="color: #0000FF;">.</span><span style="color: #000000;">e</span> <span style="color: #000080;font-style:italic;">-- see [[Rosetta_Code/Count_examples#Phix]]</span>
<span style="color: #008080;">constant</span> <span style="color: #000000;">history_user</span> <span style="color: #0000FF;">=</span> <span style="color: #008000;">`&lt;span class='history-user'&gt;&lt;a href="`</span>
<span style="color: #008080;">function</span> <span style="color: #000000;">count_tasks</span><span style="color: #0000FF;">()</span>
<span style="color: #008080;">if</span> <span style="color: #7060A8;">get_file_type</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"rc_cache"</span><span style="color: #0000FF;">)!=</span><span style="color: #004600;">FILETYPE_DIRECTORY</span> <span style="color: #008080;">then</span>
<span style="color: #008080;">if</span> <span style="color: #008080;">not</span> <span style="color: #000000;">create_directory</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"rc_cache"</span><span style="color: #0000FF;">)</span> <span style="color: #008080;">then</span>
<span style="color: #7060A8;">crash</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"cannot create rc_cache directory"</span><span style="color: #0000FF;">)</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
<span style="color: #004080;">sequence</span> <span style="color: #000000;">tasks</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">dewiki</span><span style="color: #0000FF;">(</span><span style="color: #000000;">open_category</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"Programming_Tasks"</span><span style="color: #0000FF;">,</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #000000;">2</span><span style="color: #0000FF;">))</span>
<span style="color: #0000FF;">&</span> <span style="color: #000000;">dewiki</span><span style="color: #0000FF;">(</span><span style="color: #000000;">open_category</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"Draft_Programming_Tasks"</span><span style="color: #0000FF;">,</span><span style="color: #000000;">2</span><span style="color: #0000FF;">,</span><span style="color: #000000;">2</span><span style="color: #0000FF;">))</span>
<span style="color: #004080;">integer</span> <span style="color: #000000;">ntasks</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">length</span><span style="color: #0000FF;">(</span><span style="color: #000000;">tasks</span><span style="color: #0000FF;">)</span>
<span style="color: #004080;">sequence</span> <span style="color: #000000;">users</span> <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">{},</span>
<span style="color: #000000;">utask</span> <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">{},</span>
<span style="color: #000000;">ntask</span> <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">{}</span>
<span style="color: #008080;">for</span> <span style="color: #000000;">i</span><span style="color: #0000FF;">=</span><span style="color: #000000;">1</span> <span style="color: #008080;">to</span> <span style="color: #000000;">ntasks</span> <span style="color: #008080;">do</span>
<span style="color: #004080;">string</span> <span style="color: #000000;">ti</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">tasks</span><span style="color: #0000FF;">[</span><span style="color: #000000;">i</span><span style="color: #0000FF;">],</span>
<span style="color: #000000;">url</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">sprintf</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"http://rosettacode.org/mw/index.php?title=%s&action=history&dir=prev&limit=1"</span><span style="color: #0000FF;">,{</span><span style="color: #000000;">ti</span><span style="color: #0000FF;">}),</span>
<span style="color: #000000;">contents</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">open_download</span><span style="color: #0000FF;">(</span><span style="color: #000000;">ti</span><span style="color: #0000FF;">&</span><span style="color: #008000;">".hist"</span><span style="color: #0000FF;">,</span><span style="color: #000000;">url</span><span style="color: #0000FF;">,</span><span style="color: #000000;">i</span><span style="color: #0000FF;">,</span><span style="color: #000000;">ntasks</span><span style="color: #0000FF;">)</span>
<span style="color: #004080;">integer</span> <span style="color: #000000;">k</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">match</span><span style="color: #0000FF;">(</span><span style="color: #000000;">history_user</span><span style="color: #0000FF;">,</span><span style="color: #000000;">contents</span><span style="color: #0000FF;">)</span>
<span style="color: #008080;">if</span> <span style="color: #000000;">k</span><span style="color: #0000FF;">=</span><span style="color: #000000;">0</span> <span style="color: #008080;">then</span> <span style="color: #0000FF;">?</span><span style="color: #000000;">9</span><span style="color: #0000FF;">/</span><span style="color: #000000;">0</span> <span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
<span style="color: #000000;">k</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">find</span><span style="color: #0000FF;">(</span><span style="color: #008000;">'&gt;'</span><span style="color: #0000FF;">,</span><span style="color: #000000;">contents</span><span style="color: #0000FF;">,</span><span style="color: #000000;">k</span><span style="color: #0000FF;">+</span><span style="color: #7060A8;">length</span><span style="color: #0000FF;">(</span><span style="color: #000000;">history_user</span><span style="color: #0000FF;">))</span>
<span style="color: #008080;">if</span> <span style="color: #000000;">k</span><span style="color: #0000FF;">=</span><span style="color: #000000;">0</span> <span style="color: #008080;">then</span> <span style="color: #0000FF;">?</span><span style="color: #000000;">9</span><span style="color: #0000FF;">/</span><span style="color: #000000;">0</span> <span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
<span style="color: #000000;">k</span> <span style="color: #0000FF;">+=</span> <span style="color: #000000;">1</span>
<span style="color: #004080;">integer</span> <span style="color: #000000;">e</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">match</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"&lt;/a&gt;"</span><span style="color: #0000FF;">,</span><span style="color: #000000;">contents</span><span style="color: #0000FF;">,</span><span style="color: #000000;">k</span><span style="color: #0000FF;">)</span>
<span style="color: #008080;">if</span> <span style="color: #000000;">e</span><span style="color: #0000FF;">=</span><span style="color: #000000;">0</span> <span style="color: #008080;">then</span> <span style="color: #0000FF;">?</span><span style="color: #000000;">9</span><span style="color: #0000FF;">/</span><span style="color: #000000;">0</span> <span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
<span style="color: #004080;">string</span> <span style="color: #000000;">user</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">contents</span><span style="color: #0000FF;">[</span><span style="color: #000000;">k</span><span style="color: #0000FF;">..</span><span style="color: #000000;">e</span><span style="color: #0000FF;">-</span><span style="color: #000000;">1</span><span style="color: #0000FF;">]</span>
<span style="color: #000000;">k</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">find</span><span style="color: #0000FF;">(</span><span style="color: #000000;">user</span><span style="color: #0000FF;">,</span><span style="color: #000000;">users</span><span style="color: #0000FF;">)</span>
<span style="color: #008080;">if</span> <span style="color: #000000;">k</span><span style="color: #0000FF;">=</span><span style="color: #000000;">0</span> <span style="color: #008080;">then</span>
<span style="color: #000000;">users</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">append</span><span style="color: #0000FF;">(</span><span style="color: #000000;">users</span><span style="color: #0000FF;">,</span><span style="color: #000000;">user</span><span style="color: #0000FF;">)</span>
<span style="color: #000000;">utask</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">append</span><span style="color: #0000FF;">(</span><span style="color: #000000;">utask</span><span style="color: #0000FF;">,{</span><span style="color: #000000;">i</span><span style="color: #0000FF;">})</span>
<span style="color: #000000;">ntask</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">append</span><span style="color: #0000FF;">(</span><span style="color: #000000;">ntask</span><span style="color: #0000FF;">,</span><span style="color: #000000;">1</span><span style="color: #0000FF;">)</span>
<span style="color: #008080;">else</span>
<span style="color: #000000;">utask</span><span style="color: #0000FF;">[</span><span style="color: #000000;">k</span><span style="color: #0000FF;">]</span> <span style="color: #0000FF;">&=</span> <span style="color: #000000;">i</span>
<span style="color: #000000;">ntask</span><span style="color: #0000FF;">[</span><span style="color: #000000;">k</span><span style="color: #0000FF;">]</span> <span style="color: #0000FF;">+=</span> <span style="color: #000000;">1</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
<span style="color: #000000;">ti</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">html_clean</span><span style="color: #0000FF;">(</span><span style="color: #000000;">ti</span><span style="color: #0000FF;">)</span> <span style="color: #000080;font-style:italic;">-- (in case you want to show them)</span>
<span style="color: #000000;">tasks</span><span style="color: #0000FF;">[</span><span style="color: #000000;">i</span><span style="color: #0000FF;">]</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">ti</span>
<span style="color: #008080;">if</span> <span style="color: #7060A8;">get_key</span><span style="color: #0000FF;">()=</span><span style="color: #000000;">#1B</span> <span style="color: #008080;">then</span> <span style="color: #7060A8;">progress</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"escape keyed\n"</span><span style="color: #0000FF;">)</span> <span style="color: #008080;">exit</span> <span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">for</span>
<span style="color: #000000;">curl_cleanup</span><span style="color: #0000FF;">()</span>
<span style="color: #7060A8;">progress</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"\n"</span><span style="color: #0000FF;">)</span>
<span style="color: #004080;">integer</span> <span style="color: #000000;">nusers</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">length</span><span style="color: #0000FF;">(</span><span style="color: #000000;">users</span><span style="color: #0000FF;">)</span>
<span style="color: #004080;">sequence</span> <span style="color: #000000;">tags</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">custom_sort</span><span style="color: #0000FF;">(</span><span style="color: #000000;">ntask</span><span style="color: #0000FF;">,</span><span style="color: #7060A8;">tagset</span><span style="color: #0000FF;">(</span><span style="color: #000000;">nusers</span><span style="color: #0000FF;">))</span>
<span style="color: #004080;">integer</span> <span style="color: #000000;">top5</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">0</span>
<span style="color: #008080;">for</span> <span style="color: #000000;">i</span><span style="color: #0000FF;">=</span><span style="color: #000000;">nusers</span> <span style="color: #008080;">to</span> <span style="color: #000000;">1</span> <span style="color: #008080;">by</span> <span style="color: #0000FF;">-</span><span style="color: #000000;">1</span> <span style="color: #008080;">do</span>
<span style="color: #004080;">integer</span> <span style="color: #000000;">ui</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">tags</span><span style="color: #0000FF;">[</span><span style="color: #000000;">i</span><span style="color: #0000FF;">]</span>
<span style="color: #008080;">if</span> <span style="color: #000000;">ntask</span><span style="color: #0000FF;">[</span><span style="color: #000000;">ui</span><span style="color: #0000FF;">]<</span><span style="color: #000000;">5</span> <span style="color: #008080;">then</span> <span style="color: #008080;">exit</span> <span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"%s tasks:%d\n"</span><span style="color: #0000FF;">,{</span><span style="color: #000000;">users</span><span style="color: #0000FF;">[</span><span style="color: #000000;">ui</span><span style="color: #0000FF;">],</span><span style="color: #000000;">ntask</span><span style="color: #0000FF;">[</span><span style="color: #000000;">ui</span><span style="color: #0000FF;">]})</span>
<span style="color: #000000;">top5</span> <span style="color: #0000FF;">+=</span> <span style="color: #000000;">1</span> <span style="color: #008080;">if</span> <span style="color: #000000;">top5</span><span style="color: #0000FF;">></span><span style="color: #000000;">5</span> <span style="color: #008080;">then</span> <span style="color: #008080;">exit</span> <span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">for</span>
<span style="color: #008080;">return</span> <span style="color: #0000FF;">{</span><span style="color: #000000;">ntasks</span><span style="color: #0000FF;">,</span><span style="color: #000000;">nusers</span><span style="color: #0000FF;">}</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">function</span>
<span style="color: #7060A8;">progress</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"Total: %d tasks by %d authors\n"</span><span style="color: #0000FF;">,</span><span style="color: #000000;">count_tasks</span><span style="color: #0000FF;">())</span>
<!--</syntaxhighlight>-->
{{out}}
As of 6th Jan 2020
<pre>
Paddy3118 tasks:176
Markhobley tasks:71
Gerard Schildberger tasks:59
Mwn3d tasks:55
NevilleDNZ tasks:39
Short Circuit tasks:33
Total: 1219
</pre>
As of 6th Jan 2022
<pre>
Paddy3118 tasks:199
CalmoSoft tasks:128
Markhobley tasks:71
Gerard Schildberger tasks:66
Mwn3d tasks:55
Thundergnat tasks:44
Total: 1492 tasks by 307 authors
</pre>
 
=={{header|Raku}}==
(formerly Perl 6)
{{works with|Rakudo|2018.03}}
 
The pseudocode above is no longer really useful as the page format has changed significantly since this task was written. Rather than checking '''every''' edit to see if it was a change to the task description, we'll just assume the user that created the page is the task author. This isn't 100% accurate; a very few pages got renamed and recreated by someone other than the original author without preserving the history, so they are misreported (15 Puzzle Game for instance,) but is as good as it is likely to get without extensive manual intervention. Subsequent edits to the task description are not credited. As it is, we must still make ''thousands'' of requests and pound the server pretty hard. Checking '''every''' edit would make the task several of orders of magnitude more abusive of the server (and my internet connection.)
 
<syntaxhighlight lang="raku" line>use HTTP::UserAgent;
use URI::Escape;
use JSON::Fast;
use Sort::Naturally;
 
# Friendlier descriptions for task categories
my %cat = (
'Programming_Tasks' => 'Task',
'Draft_Programming_Tasks' => 'Draft'
);
 
my $client = HTTP::UserAgent.new;
 
my $url = 'https://rosettacode.org/w';
 
my $tablefile = './RC_Authors.txt';
my $hashfile = './RC_Authors.json';
 
my %tasks;
 
# clear screen
run($*DISTRO.is-win ?? 'cls' !! 'clear');
 
%tasks = $hashfile.IO.e ?? $hashfile.IO.slurp.&from-json !! ( );
sleep 1;
 
#=begin update
 
note 'Retrieving task information...';
 
my %filter;
for %cat.keys.sort -> $category {
mediawiki-query(
$url, 'pages',
:generator<categorymembers>,
:gcmtitle("Category:$category"),
:gcmlimit<350>,
:rawcontinue(),
:prop<title>
).map( { %filter{.<title>} = %cat{$category} } )
}
 
my $delete = %tasks.keys (-) %filter.keys;
 
%tasks.delete($_) for $delete.keys; #Tasks that have changed names or been removed
 
my @add;
for %filter.keys -> $title {
if %tasks{$title}:exists {
%tasks{$title}<category> = %filter{$title} # update status
} else {
@add.push: $title => %filter{$title} # New Tasks
}
}
 
if @add {
.say for 'Adding new tasks:', |@add;
}
 
for @add -> $task {
mediawiki-query(
$url, 'pages',
:titles($task.key),
:prop<revisions>,
:rvprop<user|timestamp>,
:rvstart<2000-01-01T01:01:01Z>,
:rvdir<newer>,
:rvlimit<1>
).map: {
print clear, 1 + $++, ' ', .[0]<title>;
%tasks{.[0]<title>}<category> = $task.value;
%tasks{.[0]<title>}<author> = .[0]<revisions>[0]<user>;
%tasks{.[0]<title>}<date> = .[0]<revisions>[0]<timestamp>.subst(/'T'.+$/, '')
}
}
 
print clear;
 
# Save information to a local file
note "\nTask information saved to local file: {$hashfile.IO.absolute}";
$hashfile.IO.spurt(%tasks.&to-json);
 
#=end update
 
# Load information from local file
%tasks = $hashfile.IO.e ?? $hashfile.IO.slurp.&from-json !! ( );
 
# Convert saved task / author info to a table
note "\nBuilding table...";
my $count = +%tasks;
my $taskcnt = +%tasks.grep: *.value.<category> eq %cat<Programming_Tasks>;
my $draftcnt = $count - $taskcnt;
 
# Open a file handle to dump table in
my $out = open($tablefile, :w) or die "$!\n";
 
# Add table boilerplate and header
$out.say:
"\{|class=\"wikitable sortable\"\n",
"|+ As of { Date.today } :: Total Tasks: { $count }:: Tasks: { $taskcnt }",
" ::<span style=\"background-color:#ffd\"> Draft Tasks: { $draftcnt } </span>",
":: By {+%tasks{*}».<author>.unique} Authors\n",
"! Author !! Tasks !! Authored"
;
 
# Get sorted unique list of task authors
for %tasks{*}».<author>.unique.sort(&naturally) -> $author {
 
# Get list of tasks by this author
my @these = %tasks.grep( { $_.value.<author> eq $author } );
my $s = +@these == 1 ?? '' !! 's';
 
# Add author and contributions link to the first two cells
$out.say:
$author ~~ /\d/
?? "|- id=\"$author\"\n|data-sort-value=\"{ sort-key $author }\"|[[User:$author|$author]]\n"~
"|data-sort-value=\"{ +@these }\"|[[Special:Contributions/$author|"~
"{ +@these } task{ $s }]]"
!! "|- id=\"$author\"\n|[[User:$author|$author]]\n"~
"|data-sort-value=\"{ +@these }\"|[[Special:Contributions/$author|"~
"{ +@these } task{ $s }]]"
;
 
if +@these > 2 {
$out.say: "|style=\"padding: 0px;\"|\n",
"\{|class=\"broadtable sortable\" style=\"width: 100%;\"\n",
"! Task Name !! Date Added !! Status";
}
else {
$out.say: "|style=\"padding: 0px;\"|\n",
"\{|class=\"broadtable\" style=\"width: 100%;\"";
}
 
# Tasks by this author, sorted by name
for @these.sort({.key.&naturally}) -> $task {
 
my $color = $task.value.<category> eq 'Draft' ?? '#ffd' !! '#fff';
 
# add the task link, date and status to the table in the second cell
$out.say: "|-\n|style=\"background-color: $color;\"",
( $task.key ~~ /\d/
?? " data-sort-value=\"{ sort-key $task.key }\"| [[{uri-escape $task.key}|{$task.key}]]\n"
!! "| [[{uri-escape $task.key}|{$task.key}]]\n"
),
"|style=\"width: 10em; background-color: $color;\"| {$task.value.<date>}\n",
"|style=\"width: 6em; background-color: $color;\"| {$task.value.<category>}",
}
$out.say: '|}'
}
$out.say( "|}\n" );
$out.close;
 
 
note "Table file saved as: {$tablefile.IO.absolute}";
 
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) { %fields.map({ "{.key}={uri-escape .value}" }).join("&") }
 
sub sort-key ($a) { $a.lc.subst(/(\d+)/, ->$/ {0~(65+($0.chars)).chr~$0},:g) }
 
sub clear { "\r" ~ ' ' x 100 ~ "\r" }</syntaxhighlight>
 
{{out|Sample output}}
 
See full output at [[Rosetta_Code/List_authors_of_task_descriptions/Full_list]]
 
{|class="wikitable sortable"
|+ As of 2018-04-10 :: Total Tasks: 1080:: Tasks: 871 ::<span style="background-color:#ffd"> Draft Tasks: 209 </span>:: By 251 Authors
! Author !! Tasks !! Authored
|-
| data-sort-value="0B2powers"|[[User:2Powers|2Powers]] : [[Special:Contributions/2Powers| 2 tasks]]
|data-sort-value="2"|[[Special:Contributions/2Powers|2 tasks]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #ffd;"| [[Names%20to%20numbers|Names to numbers]]
Line 40 ⟶ 611:
|}
|-
| data-sort-value="0C12.0D175.0C32.0C19"|[[User:12.175.32.19|12.175.32.19]] : [[Special:Contributions/12.175.32.19| 1 task]]
|data-sort-value="1"|[[Special:Contributions/12.175.32.19|1 task]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Soundex|Soundex]]
Line 50 ⟶ 621:
|}
|-
| data-sort-value="0C12me0C21"|[[User:12Me21|12Me21]] : [[Special:Contributions/12Me21| 1 task]]
|data-sort-value="1"|[[Special:Contributions/12Me21|1 task]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Draw%20a%20rotating%20cube|Draw a rotating cube]]
Line 60 ⟶ 631:
|}
|-
|colspan="3"|many rows omitted...
| [[User:64.131.185.25|64.131.185.25]] : [[Special:Contributions/64.131.185.25| 2 tasks]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Sierpinski%20carpet|Sierpinski carpet]]
|style="width: 10em; background-color: #fff;"| 2008-03-14
|style="width: 6em; background-color: #fff;"| Task
|-
|style="background-color: #fff;"| [[Sierpinski%20triangle|Sierpinski triangle]]
|style="width: 10em; background-color: #fff;"| 2008-03-14
|style="width: 6em; background-color: #fff;"| Task
|}
|-
|data-sort-value="zorro0E1024"|[[User:Zorro1024|Zorro1024]]
| [[User:66.120.226.84|66.120.226.84]] : [[Special:Contributions/66.120.226.84| 1 task]]
|data-sort-value="2"|[[Special:Contributions/Zorro1024|2 tasks]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[TopPerfect%20rank%20per%20group20shuffle|Top rank perPerfect groupshuffle]]
|style="width: 10em; background-color: #fff;"| 20082015-1204-0316
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:67.20.197.154|67.20.197.154]] : [[Special:Contributions/67.20.197.154| 1 task]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[RSA%20code|RSA code]]
|style="width: 10em; background-color: #fff;"| 2011-03-24
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:68.38.195.134|68.38.195.134]] : [[Special:Contributions/68.38.195.134| 1 task]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Zig-zag%20matrix|Zig-zag matrix]]
|style="width: 10em; background-color: #fff;"| 2008-08-03
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:68.175.31.239|68.175.31.239]] : [[Special:Contributions/68.175.31.239| 1 task]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[SEDOLs|SEDOLs]]
|style="width: 10em; background-color: #fff;"| 2008-08-02
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:69.12.181.181|69.12.181.181]] : [[Special:Contributions/69.12.181.181| 1 task]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Random%20numbers|Random numbers]]
|style="width: 10em; background-color: #fff;"| 2007-04-07
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:70.83.182.253|70.83.182.253]] : [[Special:Contributions/70.83.182.253| 6 tasks]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Check%20that%20file%20exists|Check that file exists]]
|style="width: 10em; background-color: #fff;"| 2007-04-07
|style="width: 6em; background-color: #fff;"| Task
|-
|style="background-color: #fff;"| [[Create%20a%20file|Create a file]]
|style="width: 10em; background-color: #fff;"| 2007-04-07
|style="width: 6em; background-color: #fff;"| Task
|-
|style="background-color: #fff;"| [[Delete%20a%20file|Delete a file]]
|style="width: 10em; background-color: #fff;"| 2007-04-07
|style="width: 6em; background-color: #fff;"| Task
|-
|style="background-color: #fff;"| [[File%20modification%20time|File modification time]]
|style="width: 10em; background-color: #fff;"| 2007-04-07
|style="width: 6em; background-color: #fff;"| Task
|-
|style="background-color: #fff;"| [[File%20size|File size]]
|style="width: 10em; background-color: #fff;"| 2007-04-07
|style="width: 6em; background-color: #fff;"| Task
|-
|style="background-color: #fff;"| [[Rename%20a%20file|Rename a file]]
|style="width: 10em; background-color: #fff;"| 2007-04-07
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:71.205.120.86|71.205.120.86]] : [[Special:Contributions/71.205.120.86| 1 task]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Function%20definition|Function definition]]
|style="width: 10em; background-color: #fff;"| 2007-09-18
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:74.56.102.15|74.56.102.15]] : [[Special:Contributions/74.56.102.15| 6 tasks]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Compound%20data%20type|Compound data type]]
|style="width: 10em; background-color: #fff;"| 2007-02-24
|style="width: 6em; background-color: #fff;"| Task
|-
|style="background-color: #fff;"| [[Copy%20a%20string|Copy a string]]
|style="width: 10em; background-color: #fff;"| 2007-02-22
|style="width: 6em; background-color: #fff;"| Task
|-
|style="background-color: #fff;"| [[Enumerations|Enumerations]]
|style="width: 10em; background-color: #fff;"| 2007-02-23
|style="width: 6em; background-color: #fff;"| Task
|-
|style="background-color: #fff;"| [[Increment%20a%20numerical%20string|Increment a numerical string]]
|style="width: 10em; background-color: #fff;"| 2007-02-23
|style="width: 6em; background-color: #fff;"| Task
|-
|style="background-color: #fff;"| [[Polymorphism|Polymorphism]]
|style="width: 10em; background-color: #fff;"| 2007-02-23
|style="width: 6em; background-color: #fff;"| Task
|-
|style="background-color: #fff;"| [[Stack|Stack]]
|style="width: 10em; background-color: #fff;"| 2007-02-24
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:74.74.225.216|74.74.225.216]] : [[Special:Contributions/74.74.225.216| 1 task]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Singly-linked%20list%2FTraversal|Singly-linked list/Traversal]]
|style="width: 10em; background-color: #fff;"| 2007-10-30
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:76.19.46.239|76.19.46.239]] : [[Special:Contributions/76.19.46.239| 1 task]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Non-decimal%20radices%2FConvert|Non-decimal radices/Convert]]
|style="width: 10em; background-color: #fff;"| 2008-03-07
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:76.91.63.71|76.91.63.71]] : [[Special:Contributions/76.91.63.71| 1 task]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Sorting%20algorithms%2FHeapsort|Sorting algorithms/Heapsort]]
|style="width: 10em; background-color: #fff;"| 2009-07-17
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:77.250.119.152|77.250.119.152]] : [[Special:Contributions/77.250.119.152| 1 task]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Haversine%20formula|Haversine formula]]
|style="width: 10em; background-color: #fff;"| 2011-12-02
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:78.35.107.83|78.35.107.83]] : [[Special:Contributions/78.35.107.83| 2 tasks]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Discordian%20date|Discordian date]]
|style="width: 10em; background-color: #fff;"| 2010-07-20
|style="width: 6em; background-color: #fff;"| Task
|-
|style="background-color: #fff;"| [[Leap%20year|Leap year]]
|style="width: 10em; background-color: #fff;"| 2010-07-20
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:78.146.0.60|78.146.0.60]] : [[Special:Contributions/78.146.0.60| 1 task]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Narcissist|Narcissist]]
|style="width: 10em; background-color: #fff;"| 2010-09-21
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:79.54.58.148|79.54.58.148]] : [[Special:Contributions/79.54.58.148| 1 task]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Paraffins|Paraffins]]
|style="width: 10em; background-color: #fff;"| 2011-11-30
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:82.32.24.201|82.32.24.201]] : [[Special:Contributions/82.32.24.201| 1 task]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #ffd;"| [[Aspect%20Oriented%20ProgrammingVector|Aspect Oriented ProgrammingVector]]
|style="width: 10em; background-color: #ffd;"| 20112015-0603-0921
|style="width: 6em; background-color: #ffd;"| Draft
|}
|-
|data-sort-value="zzo0C38"|[[User:Zzo38|Zzo38]]
| [[User:83.104.248.190|83.104.248.190]] : [[Special:Contributions/83.104.248.190| 1 task]]
|data-sort-value="1"|[[Special:Contributions/Zzo38|1 task]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Matrix%20multiplicationThue-Morse|Matrix multiplicationThue-Morse]]
|style="width: 10em; background-color: #fff;"| 2007-122015-09-20
|style="width: 6em; background-color: #fff;"| Task
|}
|-
|[[User:Русский|Русский]]
| [[User:87.224.129.185|87.224.129.185]] : [[Special:Contributions/87.224.129.185| 1 task]]
|data-sort-value="3"|[[Special:Contributions/Русский|3 tasks]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;" data-sort-value="main step of gost 0F28147-0C89"| [[CannyMain%20edge20step%20detector20of%20GOST%2028147-89|CannyMain step of edgeGOST detector28147-89]]
|style="width: 10em; background-color: #fff;"| 2012-0308-0531
|style="width: 6em; background-color: #fff;"| Task
|}
|-
|style="background-color: #ffd;"| [[Old%20Russian%20measure%20of%20length|Old Russian measure of length]]
| [[User:91.4.78.20|91.4.78.20]] : [[Special:Contributions/91.4.78.20| 1 task]]
|style="paddingwidth: 0px10em; background-color: #ffd;"| 2013-01-09
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Ordered%20Partitions|Ordered Partitions]]
|style="width: 10em; background-color: #fff;"| 2011-02-07
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:96.20.64.30|96.20.64.30]] : [[Special:Contributions/96.20.64.30| 1 task]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Mandelbrot%20set|Mandelbrot set]]
|style="width: 10em; background-color: #fff;"| 2009-03-31
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:99.105.56.162|99.105.56.162]] : [[Special:Contributions/99.105.56.162| 1 task]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Levenshtein%20distance|Levenshtein distance]]
|style="width: 10em; background-color: #fff;"| 2011-01-10
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:137.195.250.2|137.195.250.2]] : [[Special:Contributions/137.195.250.2| 2 tasks]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Sorting%20algorithms%2FBogosort|Sorting algorithms/Bogosort]]
|style="width: 10em; background-color: #fff;"| 2008-05-07
|style="width: 6em; background-color: #fff;"| Task
|-
|style="background-color: #fff;"| [[Sorting%20algorithms%2FPermutation%20sort|Sorting algorithms/Permutation sort]]
|style="width: 10em; background-color: #fff;"| 2008-05-08
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:142.204.88.102|142.204.88.102]] : [[Special:Contributions/142.204.88.102| 1 task]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Create%20an%20HTML%20table|Create an HTML table]]
|style="width: 10em; background-color: #fff;"| 2011-03-08
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:145.254.251.66|145.254.251.66]] : [[Special:Contributions/145.254.251.66| 1 task]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[List%20comprehensions|List comprehensions]]
|style="width: 10em; background-color: #fff;"| 2007-11-07
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:145.254.251.95|145.254.251.95]] : [[Special:Contributions/145.254.251.95| 1 task]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Pattern%20matching|Pattern matching]]
|style="width: 10em; background-color: #fff;"| 2007-11-06
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:146.201.224.238|146.201.224.238]] : [[Special:Contributions/146.201.224.238| 1 task]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Reverse%20a%20string|Reverse a string]]
|style="width: 10em; background-color: #fff;"| 2008-04-18
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:155.192.0.234|155.192.0.234]] : [[Special:Contributions/155.192.0.234| 1 task]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Sorting%20algorithms%2FStrand%20sort|Sorting algorithms/Strand sort]]
|style="width: 10em; background-color: #fff;"| 2011-05-04
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:165.124.208.73|165.124.208.73]] : [[Special:Contributions/165.124.208.73| 1 task]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Pythagoras%20tree|Pythagoras tree]]
|style="width: 10em; background-color: #fff;"| 2011-10-28
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:171.65.33.13|171.65.33.13]] : [[Special:Contributions/171.65.33.13| 1 task]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Command-line%20arguments|Command-line arguments]]
|style="width: 10em; background-color: #fff;"| 2007-02-13
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:195.33.114.129|195.33.114.129]] : [[Special:Contributions/195.33.114.129| 1 task]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Sorting%20algorithms%2FShell%20sort|Sorting algorithms/Shell sort]]
|style="width: 10em; background-color: #fff;"| 2008-05-20
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:200.102.26.6|200.102.26.6]] : [[Special:Contributions/200.102.26.6| 1 task]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[HTTP|HTTP]]
|style="width: 10em; background-color: #fff;"| 2008-09-25
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:201.67.232.39|201.67.232.39]] : [[Special:Contributions/201.67.232.39| 1 task]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Record%20sound|Record sound]]
|style="width: 10em; background-color: #fff;"| 2010-12-30
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:207.74.29.206|207.74.29.206]] : [[Special:Contributions/207.74.29.206| 1 task]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Window%20creation|Window creation]]
|style="width: 10em; background-color: #fff;"| 2007-01-15
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:209.63.105.137|209.63.105.137]] : [[Special:Contributions/209.63.105.137| 3 tasks]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Associative%20array%2FCreation|Associative array/Creation]]
|style="width: 10em; background-color: #fff;"| 2007-01-22
|style="width: 6em; background-color: #fff;"| Task
|-
|style="background-color: #fff;"| [[Fork|Fork]]
|style="width: 10em; background-color: #fff;"| 2007-02-06
|style="width: 6em; background-color: #fff;"| Task
|-
|style="background-color: #fff;"| [[Table%20creation%2FPostal%20addresses|Table creation/Postal addresses]]
|style="width: 10em; background-color: #fff;"| 2007-01-23
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:219.77.140.150|219.77.140.150]] : [[Special:Contributions/219.77.140.150| 1 task]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Factorial|Factorial]]
|style="width: 10em; background-color: #fff;"| 2008-08-17
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:Abu|Abu]] : [[Special:Contributions/Abu| 13 tasks]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Anonymous%20recursion|Anonymous recursion]]
|style="width: 10em; background-color: #fff;"| 2010-11-23
|style="width: 6em; background-color: #fff;"| Task
|-
|style="background-color: #fff;"| [[Chat%20server|Chat server]]
|style="width: 10em; background-color: #fff;"| 2010-12-10
|style="width: 6em; background-color: #fff;"| Task
|-
|style="background-color: #ffd;"| [[Chess%20player|Chess player]]
|style="width: 10em; background-color: #ffd;"| 2012-04-24
|style="width: 6em; background-color: #ffd;"| Draft
|-
|style="background-color: #fffffd;"| [[ExtendTransportation%20your%20language20problem|Extend yourTransportation languageproblem]]
|style="width: 10em; background-color: #fffffd;"| 20102013-0805-2724
|style="width: 6em; background-color: #fff;"| Task
|-
|style="background-color: #fff;"| [[First%20class%20environments|First class environments]]
|style="width: 10em; background-color: #fff;"| 2011-06-30
|style="width: 6em; background-color: #fff;"| Task
|-
|style="background-color: #fff;"| [[Function%20frequency|Function frequency]]
|style="width: 10em; background-color: #fff;"| 2011-11-02
|style="width: 6em; background-color: #fff;"| Task
|-
|style="background-color: #fff;"| [[GUI%20component%20interaction|GUI component interaction]]
|style="width: 10em; background-color: #fff;"| 2010-08-23
|style="width: 6em; background-color: #fff;"| Task
|-
|style="background-color: #fff;"| [[GUI%20enabling%2Fdisabling%20of%20controls|GUI enabling/disabling of controls]]
|style="width: 10em; background-color: #fff;"| 2010-08-23
|style="width: 6em; background-color: #fff;"| Task
|-
|style="background-color: #fff;"| [[Maze%20generation|Maze generation]]
|style="width: 10em; background-color: #fff;"| 2010-12-14
|style="width: 6em; background-color: #fff;"| Task
|-
|style="background-color: #fff;"| [[Maze%20solving|Maze solving]]
|style="width: 10em; background-color: #fff;"| 2010-12-15
|style="width: 6em; background-color: #fff;"| Task
|-
|style="background-color: #fff;"| [[Morse%20code|Morse code]]
|style="width: 10em; background-color: #fff;"| 2010-08-24
|style="width: 6em; background-color: #fff;"| Task
|-
|style="background-color: #fff;"| [[Parallel%20calculations|Parallel calculations]]
|style="width: 10em; background-color: #fff;"| 2010-12-15
|style="width: 6em; background-color: #fff;"| Task
|-
|style="background-color: #fff;"| [[Random%20number%20generator%20%28device%29|Random number generator (device)]]
|style="width: 10em; background-color: #fff;"| 2011-01-11
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:Adonis|Adonis]] : [[Special:Contributions/Adonis| 3 tasks]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Classes|Classes]]
|style="width: 10em; background-color: #fff;"| 2007-01-27
|style="width: 6em; background-color: #fff;"| Task
|-
|style="background-color: #fff;"| [[Walk%20a%20directory%2FNon-recursively|Walk a directory/Non-recursively]]
|style="width: 10em; background-color: #fff;"| 2007-01-24
|style="width: 6em; background-color: #fff;"| Task
|-
|style="background-color: #fff;"| [[XML%2FDOM%20serialization|XML/DOM serialization]]
|style="width: 10em; background-color: #fff;"| 2007-01-24
|style="width: 6em; background-color: #fff;"| Task
|}
|-
| [[User:Akshay|Akshay]] : [[Special:Contributions/Akshay| 1 task]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #ffd;"| [[Dijkstra%27s%20algorithm|Dijkstra's algorithm]]
|style="width: 10em; background-color: #ffd;"| 2011-12-08
|style="width: 6em; background-color: #ffd;"| Draft
|}
|-
| [[User:AlainD|AlainD]] : [[Special:Contributions/AlainD| 2 tasks]]
|style="padding: 0px;"|
{|class="broadtable sortable" style="width: 100%;"
! Task Name !! Date Added !! Status
|-
|style="background-color: #fff;"| [[Fractran|Fractran]]
|style="width: 10em; background-color: #fff;"| 2014-01-20
|style="width: 6em; background-color: #fff;"| Task
|-
|style="background-color: #fff;"| [[URL%20parser|URL parser]]
|style="width: 10em; background-color: #fff;"| 2015-07-22
|style="width: 6em; background-color: #fff;"| Task
|}
 
|-
=={{header|Wren}}==
| [[User:Alegend|Alegend]] : [[Special:Contributions/Alegend| 1 task]]
{{libheader|libcurl}}
|style="padding: 0px;"|
{{libheader|Wren-pattern}}
{|class="broadtable sortable" style="width: 100%;"
{{libheader|Wren-fmt}}
! Task Name !! Date Added !! Status
An embedded program so we can use libcurl.
|-
 
|style="background-color: #fff;"| [[Evaluate%20binomial%20coefficients|Evaluate binomial coefficients]]
Takes upwards of 80 minutes to run as the history page(s) for each task need to be downloaded and parsed to find the author. Worse still, given we are pounding a busy server pretty hard, there are lots of 'bad gateway' and other errors (94 on this particular run!) which necessitate adding tasks back to the task list until they are eventually downloaded and parsed successfully which can add several minutes to the overall time.
|style="width: 10em; background-color: #fff;"| 2010-04-11
<syntaxhighlight lang="wren">/* Rosetta_Code_List_authors_of_task_descriptions.wren */
|style="width: 6em; background-color: #fff;"| Task
 
|}
import "./pattern" for Pattern
|-
import "./fmt" for Fmt
| [[User:AlexLehm|AlexLehm]] : [[Special:Contributions/AlexLehm| 1 task]]
 
|style="padding: 0px;"|
var CURLOPT_URL = 10002
{|class="broadtable sortable" style="width: 100%;"
var CURLOPT_FOLLOWLOCATION = 52
! Task Name !! Date Added !! Status
var CURLOPT_WRITEFUNCTION = 20011
|-
var CURLOPT_WRITEDATA = 10001
|style="background-color: #fff;"| [[Langton%27s%20ant|Langton's ant]]
 
|style="width: 10em; background-color: #fff;"| 2011-10-30
foreign class Buffer {
|style="width: 6em; background-color: #fff;"| Task
construct new() {} // C will allocate buffer of a suitable size
|}
 
|-
foreign value // returns buffer contents as a string
| [[User:Aloisdg|Aloisdg]] : [[Special:Contributions/Aloisdg| 4 tasks]]
}
|style="padding: 0px;"|
 
{|class="broadtable sortable" style="width: 100%;"
foreign class Curl {
! Task Name !! Date Added !! Status
construct easyInit() {}
|-
 
|style="background-color: #ffd;"| [[Diversity%20prediction%20theorem|Diversity prediction theorem]]
foreign easySetOpt(opt, param)
|style="width: 10em; background-color: #ffd;"| 2016-12-03
 
|style="width: 6em; background-color: #ffd;"| Draft
foreign easyPerform()
|-
 
|style="background-color: #fff;"| [[Munchausen%20numbers|Munchausen numbers]]
foreign easyCleanup()
|style="width: 10em; background-color: #fff;"| 2016-09-22
}
|style="width: 6em; background-color: #fff;"| Task
 
|-
var curl = Curl.easyInit()
|style="background-color: #ffd;"| [[Sattolo%20cycle|Sattolo cycle]]
 
|style="width: 10em; background-color: #ffd;"| 2016-08-29
var getContent = Fn.new { |url|
|style="width: 6em; background-color: #ffd;"| Draft
var buffer = Buffer.new()
|-
curl.easySetOpt(CURLOPT_URL, url)
|style="background-color: #ffd;"| [[Two%20Sum|Two Sum]]
curl.easySetOpt(CURLOPT_FOLLOWLOCATION, 1)
|style="width: 10em; background-color: #ffd;"| 2016-10-04
curl.easySetOpt(CURLOPT_WRITEFUNCTION, 0) // write function to be supplied by C
|style="width: 6em; background-color: #ffd;"| Draft
curl.easySetOpt(CURLOPT_WRITEDATA, buffer)
|}
curl.easyPerform()
|-
return buffer.value
| [[User:AnatolV|AnatolV]] : [[Special:Contributions/AnatolV| 2 tasks]]
}
|style="padding: 0px;"|
 
{|class="broadtable sortable" style="width: 100%;"
var p1 = Pattern.new("title/=\"[+1^\"]\"")
! Task Name !! Date Added !! Status
var p2 = Pattern.new("cmcontinue/=\"[+1^\"]\"")
|-
var pi = "\"&"
|style="background-color: #fff;"| [[Kronecker%20product|Kronecker product]]
var p3 = Pattern.new("a href/=\"//[wiki//User:|w//index.php?title/=User:|wiki//Special:Contributions//][+1/I]\"", 0, pi)
|style="width: 10em; background-color: #fff;"| 2017-04-05
 
|style="width: 6em; background-color: #fff;"| Task
var findTasks = Fn.new { |category|
|-
var url = "https://www.rosettacode.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:%(category)&cmlimit=500&format=xml"
|style="background-color: #fff;"| [[Kronecker%20product%20based%20fractals|Kronecker product based fractals]]
var cmcontinue = ""
|style="width: 10em; background-color: #fff;"| 2017-04-05
var tasks = []
|style="width: 6em; background-color: #fff;"| Task
while (true) {
|}
var content = getContent.call(url + cmcontinue)
|-
var matches1 = p1.findAll(content)
| [[User:Avi|Avi]] : [[Special:Contributions/Avi| 7 tasks]]
for (m in matches1) {
|style="padding: 0px;"|
var title = m.capsText[0].replace("&#039;", "'").replace("&quot;", "\"")
{|class="broadtable sortable" style="width: 100%;"
tasks.add(title)
! Task Name !! Date Added !! Status
}
|-
var m2 = p2.find(content)
|style="background-color: #fff;"| [[Cholesky%20decomposition|Cholesky decomposition]]
if (m2) cmcontinue = "&cmcontinue=%(m2.capsText[0])" else break
|style="width: 10em; background-color: #fff;"| 2011-03-07
}
|style="width: 6em; background-color: #fff;"| Task
return tasks
|-
}
|style="background-color: #fff;"| [[Element-wise%20operations|Element-wise operations]]
 
|style="width: 10em; background-color: #fff;"| 2011-06-08
var tasks = findTasks.call("Programming_Tasks") // 'full' tasks only
|style="width: 6em; background-color: #fff;"| Task
tasks.addAll(findTasks.call("Draft_Programming_Tasks"))
|-
var tc = tasks.count
|style="background-color: #fff;"| [[Euler%20method|Euler method]]
var authors = {}
|style="width: 10em; background-color: #fff;"| 2011-03-06
while (tasks.count > 0) {
|style="width: 6em; background-color: #fff;"| Task
var task = tasks[0].replace(" ", "_").replace("+", "\%2B")
|-
// check the last or only history page for each task
|style="background-color: #fff;"| [[LU%20decomposition|LU decomposition]]
var url = "https://rosettacode.org/w/index.php?title=%(task)&dir=prev&action=history"
|style="width: 10em; background-color: #fff;"| 2011-03-11
tasks.removeAt(0)
|style="width: 6em; background-color: #fff;"| Task
var content = getContent.call(url)
|-
content = content.replace("http://www.rosettacode.org", "")
|style="background-color: #fff;"| [[Numerical%20integration%2FGauss-Legendre%20Quadrature|Numerical integration/Gauss-Legendre Quadrature]]
var matches = p3.findAll(content)
|style="width: 10em; background-color: #fff;"| 2011-05-28
// if there are no matches there must have been a 'bad gateway' or other error
|style="width: 6em; background-color: #fff;"| Task
if (matches.count == 0) {
|-
// add back a failed task until it eventually succeeds
|style="background-color: #fff;"| [[QR%20decomposition|QR decomposition]]
tasks.add(task)
|style="width: 10em; background-color: #fff;"| 2011-06-17
continue
|style="width: 6em; background-color: #fff;"| Task
}
|-
// the task author should be the final user on that page
|style="background-color: #fff;" data-sort-value="utf-0�8 encode and decode
var author = matches[-1].capsText[1].replace("_", " ")
// add this task to the author's count
if (authors.containsKey(author)) {
authors[author] = authors[author] + 1
} else {
authors[author] = 1
}
}
 
// sort the authors in descending order by number of tasks created
var authorNumbers = authors.toList
authorNumbers.sort { |a, b| a.value > b.value }
// print those who've completed at least 9 tasks
System.print("As at 10th September 2022:\n")
System.print("Total tasks : %(tc)")
System.print("Total authors : %(authors.count)")
System.print("\nThe authors who have created at least 9 tasks are:\n")
System.print("Pos Tasks Author")
System.print("==== ===== ======")
var lastNumber = 0
var lastIndex = -1
var i = 0
for (authorNumber in authorNumbers.where { |me| me.value >= 9 }) {
var j = i
var eq = " "
if (authorNumber.value == lastNumber) {
j = lastIndex
eq = "="
} else {
lastIndex = i
lastNumber = authorNumber.value
}
Fmt.print("$3d$s $3d $s", j+1, eq, authorNumber.value, authorNumber.key)
i = i + 1
}
curl.easyCleanup()</syntaxhighlight>
<br>
We now embed this script in the following C program, build and run.
<syntaxhighlight lang="c">/* gcc Rosetta_Code_List_authors_of_task_descriptions.c -o Rosetta_Code_List_authors_of_task_descriptions -lcurl -lwren -lm */
 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h>
#include "wren.h"
 
struct MemoryStruct {
char *memory;
size_t size;
};
 
/* C <=> Wren interface functions */
 
static size_t WriteMemoryCallback(void *contents, size_t size, size_t nmemb, void *userp) {
size_t realsize = size * nmemb;
struct MemoryStruct *mem = (struct MemoryStruct *)userp;
char *ptr = realloc(mem->memory, mem->size + realsize + 1);
if(!ptr) {
/* out of memory! */
printf("not enough memory (realloc returned NULL)\n");
return 0;
}
 
mem->memory = ptr;
memcpy(&(mem->memory[mem->size]), contents, realsize);
mem->size += realsize;
mem->memory[mem->size] = 0;
return realsize;
}
 
void C_bufferAllocate(WrenVM* vm) {
struct MemoryStruct *ms = (struct MemoryStruct *)wrenSetSlotNewForeign(vm, 0, 0, sizeof(struct MemoryStruct));
ms->memory = malloc(1);
ms->size = 0;
}
 
void C_bufferFinalize(void* data) {
struct MemoryStruct *ms = (struct MemoryStruct *)data;
free(ms->memory);
}
 
void C_curlAllocate(WrenVM* vm) {
CURL** pcurl = (CURL**)wrenSetSlotNewForeign(vm, 0, 0, sizeof(CURL*));
*pcurl = curl_easy_init();
}
 
void C_value(WrenVM* vm) {
struct MemoryStruct *ms = (struct MemoryStruct *)wrenGetSlotForeign(vm, 0);
wrenSetSlotString(vm, 0, ms->memory);
}
 
void C_easyPerform(WrenVM* vm) {
CURL* curl = *(CURL**)wrenGetSlotForeign(vm, 0);
curl_easy_perform(curl);
}
 
void C_easyCleanup(WrenVM* vm) {
CURL* curl = *(CURL**)wrenGetSlotForeign(vm, 0);
curl_easy_cleanup(curl);
}
 
void C_easySetOpt(WrenVM* vm) {
CURL* curl = *(CURL**)wrenGetSlotForeign(vm, 0);
CURLoption opt = (CURLoption)wrenGetSlotDouble(vm, 1);
if (opt < 10000) {
long lparam = (long)wrenGetSlotDouble(vm, 2);
curl_easy_setopt(curl, opt, lparam);
} else if (opt < 20000) {
if (opt == CURLOPT_WRITEDATA) {
struct MemoryStruct *ms = (struct MemoryStruct *)wrenGetSlotForeign(vm, 2);
curl_easy_setopt(curl, opt, (void *)ms);
} else if (opt == CURLOPT_URL) {
const char *url = wrenGetSlotString(vm, 2);
curl_easy_setopt(curl, opt, url);
}
} else if (opt < 30000) {
if (opt == CURLOPT_WRITEFUNCTION) {
curl_easy_setopt(curl, opt, &WriteMemoryCallback);
}
}
}
 
WrenForeignClassMethods bindForeignClass(WrenVM* vm, const char* module, const char* className) {
WrenForeignClassMethods methods;
methods.allocate = NULL;
methods.finalize = NULL;
if (strcmp(module, "main") == 0) {
if (strcmp(className, "Buffer") == 0) {
methods.allocate = C_bufferAllocate;
methods.finalize = C_bufferFinalize;
} else if (strcmp(className, "Curl") == 0) {
methods.allocate = C_curlAllocate;
}
}
return methods;
}
 
WrenForeignMethodFn bindForeignMethod(
WrenVM* vm,
const char* module,
const char* className,
bool isStatic,
const char* signature) {
if (strcmp(module, "main") == 0) {
if (strcmp(className, "Buffer") == 0) {
if (!isStatic && strcmp(signature, "value") == 0) return C_value;
} else if (strcmp(className, "Curl") == 0) {
if (!isStatic && strcmp(signature, "easySetOpt(_,_)") == 0) return C_easySetOpt;
if (!isStatic && strcmp(signature, "easyPerform()") == 0) return C_easyPerform;
if (!isStatic && strcmp(signature, "easyCleanup()") == 0) return C_easyCleanup;
}
}
return NULL;
}
 
static void writeFn(WrenVM* vm, const char* text) {
printf("%s", text);
}
 
void errorFn(WrenVM* vm, WrenErrorType errorType, const char* module, const int line, const char* msg) {
switch (errorType) {
case WREN_ERROR_COMPILE:
printf("[%s line %d] [Error] %s\n", module, line, msg);
break;
case WREN_ERROR_STACK_TRACE:
printf("[%s line %d] in %s\n", module, line, msg);
break;
case WREN_ERROR_RUNTIME:
printf("[Runtime Error] %s\n", msg);
break;
}
}
 
char *readFile(const char *fileName) {
FILE *f = fopen(fileName, "r");
fseek(f, 0, SEEK_END);
long fsize = ftell(f);
rewind(f);
char *script = malloc(fsize + 1);
fread(script, 1, fsize, f);
fclose(f);
script[fsize] = 0;
return script;
}
 
static void loadModuleComplete(WrenVM* vm, const char* module, WrenLoadModuleResult result) {
if( result.source) free((void*)result.source);
}
 
WrenLoadModuleResult loadModule(WrenVM* vm, const char* name) {
WrenLoadModuleResult result = {0};
if (strcmp(name, "random") != 0 && strcmp(name, "meta") != 0) {
result.onComplete = loadModuleComplete;
char fullName[strlen(name) + 6];
strcpy(fullName, name);
strcat(fullName, ".wren");
result.source = readFile(fullName);
}
return result;
}
 
int main(int argc, char **argv) {
WrenConfiguration config;
wrenInitConfiguration(&config);
config.writeFn = &writeFn;
config.errorFn = &errorFn;
config.bindForeignClassFn = &bindForeignClass;
config.bindForeignMethodFn = &bindForeignMethod;
config.loadModuleFn = &loadModule;
WrenVM* vm = wrenNewVM(&config);
const char* module = "main";
const char* fileName = "Rosetta_Code_List_authors_of_task_descriptions.wren";
char *script = readFile(fileName);
WrenInterpretResult result = wrenInterpret(vm, module, script);
switch (result) {
case WREN_RESULT_COMPILE_ERROR:
printf("Compile Error!\n");
break;
case WREN_RESULT_RUNTIME_ERROR:
printf("Runtime Error!\n");
break;
case WREN_RESULT_SUCCESS:
break;
}
wrenFreeVM(vm);
free(script);
return 0;
}</syntaxhighlight>
 
{{out}}
<pre>
As at 10th September 2022:
 
Total tasks : 1569
Total authors : 315
 
The authors who have created at least 9 tasks are:
 
Pos Tasks Author
==== ===== ======
1 199 Paddy3118
2 135 CalmoSoft
3 74 Thundergnat
4 71 Markhobley
5 66 Gerard Schildberger
6 55 Mwn3d
7 39 NevilleDNZ
7= 39 Nigel Galloway
9 33 MikeMol
10 27 PureFox
11 23 Grondilu
12 21 Blue Prawn
13 20 Fwend
13= 20 Dkf
15 19 Wherrera
16 18 Kernigh
17 17 Dmitry-kazakov
17= 17 ShinTakezou
17= 17 Ledrug
20 13 Paulo Jorente
20= 13 Abu
20= 13 Waldorf
23 12 Ce
23= 12 Kevin Reid
23= 12 Puppydrum64
26 10 Bearophile
26= 10 Tinku99
28 9 TimSC
28= 9 Petelomax
28= 9 EMBee
28= 9 Trizen
</pre>
9,476

edits