Anonymous user
Rosetta Code/Tasks without examples: Difference between revisions
Rosetta Code/Tasks without examples (view source)
Revision as of 18:31, 21 December 2017
, 6 years ago→{{header|zkl}}: added code
m (→{{header|VBScript}}: added zkl header) |
(→{{header|zkl}}: added code) |
||
Line 222:
=={{header|zkl}}==
This is a bit of a twist on the task: Programmer wants to know which tasks
have not been implimeted by their favorite language.
Uses libraries cURL and YAJL (yet another json library).
<lang zkl>var [const] CURL=Import("zklCurl"), YAJL=Import("zklYAJL")[0];
fcn getTasks(language){
continueValue,tasks,curl := "",Data(0,String), CURL(); // "nm\0nm\0...."
do{ // eg 5 times
page:=curl.get(("http://rosettacode.org/mw/api.php?"
"action=query&cmlimit=500"
"&format=json"
"&list=categorymembers"
"&cmtitle=Category:%s"
"&cmcontinue=%s").fmt(language,continueValue));
page=page[0].del(0,page[1]); // get rid of HTML header
json:=YAJL().write(page).close();
json["query"]["categorymembers"].pump(tasks,T("get","title"));
continueValue=json.find("continue") #{continue : -||,cmcontinue:page|954|19)}
.toList() # ( ("continue","-||"), ("cmcontinue","page|954|19") )
.apply("concat","=").concat("&"); # continue=-||&cmcontinue=page|954|19
}while(continueValue);
tasks
}
var allTasks=getTasks.future("Programming_Tasks"); // thread
var draftTasks=getTasks.future("Draft_Programming_Tasks"); // thread
var tasks=getTasks.future("zkl"); // thread
fcn newTasks{
langTasks:=Dictionary(); tasks.pump(Void,langTasks.add.fp1(Void));
unimplementedTasks:=allTasks.filter('wrap(nm){ (not langTasks.holds(nm)) })
.extend(draftTasks.filter('wrap(nm){ (not langTasks.holds(nm)) }));
println("http://rosettacode.org/wiki/Reports:Tasks_not_implemented_in_Zkl\n");
unimplementedTasks.pump(List()).sort().pump(Console.println);
}
newTasks();</lang>
{{out}}
<pre>
$ zkl rs_tasks_without.zkl
http://rosettacode.org/wiki/Reports:Tasks_not_implemented_in_Zkl
15 Puzzle Game
15 puzzle solver
2048
ASCII art diagram converter
AVL tree
Ackermann function
...
</pre>
|