Skip to content

Commit 982610d

Browse files
committed
a tiny script to help us spot unimplemented tasks in Arturo (that one of given "competitors" *has* implemented
1 parent 1fc8f2b commit 982610d

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

tools/findrosettatosolve.art

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
;------------------------------------------
2+
; Configuration
3+
;------------------------------------------
4+
5+
API_URL: "https://rosettacode.org/w/api.php"
6+
7+
;------------------------------------------
8+
; Helper Functions
9+
;------------------------------------------
10+
11+
fetchCategory: function [category][
12+
results: []
13+
continue: ""
14+
15+
while ø [
16+
; build query parameters
17+
params: #[
18+
action: "query"
19+
list: "categorymembers"
20+
cmtitle: ~"Category:|category|"
21+
cmlimit: "500"
22+
format: "json"
23+
]
24+
25+
; add continue parameter if we have one
26+
unless empty? continue ->
27+
params\cmcontinue: continue
28+
29+
; perform API request
30+
response: request API_URL params
31+
body: read.json response\body
32+
33+
; extract page titles and add to results
34+
'results ++ map body\query\categorymembers 'page ->
35+
page\title
36+
37+
; check if we need to continue
38+
switch key? body 'continue
39+
-> continue: body\continue\cmcontinue
40+
-> break
41+
]
42+
43+
return results
44+
]
45+
46+
competitors: arg
47+
48+
print "Fetching all programming tasks..."
49+
allTasks: fetchCategory "Programming_Tasks"
50+
51+
print ~"Fetching tasks implemented in Arturo..."
52+
arturoTasks: fetchCategory "arturo"
53+
arturoUnimplemented: difference allTasks arturoTasks
54+
55+
print ~"Fetching tasks implemented in competitors..."
56+
competitorsTasks: map competitors 'comp [
57+
print ["\t-" capitalize comp]
58+
fetchCategory comp
59+
]
60+
61+
commonInCompetitors: fold.seed:first competitorsTasks drop competitorsTasks [a b][ intersection a b ]
62+
print.lines intersection arturoUnimplemented commonInCompetitors
63+

0 commit comments

Comments
 (0)