Rosetta Code - Language Popularity
Published on
A challenge was issued recently by Sean Stephens, LassoSoft Inc.'s CEO... and it boils down to this: the person who amasses the most meaninful contribution to Lasso on Rosetta Code in the month of November 2013 will win cold hard cash.
I couldn't resist :)
One of the challenges I did was this one: Rosetta Code/Rank languages by popularity
The code I used is below, as well as the live output (takes a while to load as it's not cached).
The great thing is every few days I check it, and Lasso is steadily climbing the ranks. As of this morning (Nov 13th 2013) it was 67th.
Update: 24 hours later (Nov 14th), 65th with 222 examples...
Update #2: Nov 15th, after filtering out subcategories and a few wiki headings, 55th with 227.
sys_listtraits !>> 'xml_tree_trait' ? include('xml_tree.lasso')
local(lang = array)
local(f = curl('http://rosettacode.org/mw/index.php?title=Special:Categories&limit=5000')->result->asString)
local(ff) = xml_tree(#f)
local(lis = #ff->body->div(3)->div(3)->div(3)->div->ul->getnodes)
with li in #lis do => {
local(title = #li->a->attribute('title'))
#title->removeLeading('Category:')
local(num = #li->asString->split('(')->last)
#num->removeTrailing(')')
#num->removeTrailing('members')
#num->removeTrailing('member')
#num->trim
#num = integer(#num)
#lang->insert(#title = #num)
}
local(c = 1)
with l in #lang
order by #l->second descending
do => {^
#c++
'. '+#l->second + ' - ' + #l->first+'\r'
^}
Results:
Loading...