Talk:Rosetta Code/Rank languages by popularity: Difference between revisions

From Rosetta Code
Content added Content deleted
(→‎task clarification: added comment. -- ~~~~)
(→‎wanted: a complete list: added comment about reducing the amount of output. -- ~~~~)
Line 203: Line 203:


I'll try to update it once a month or so. -- [[User:Gerard Schildberger|Gerard Schildberger]] 23:53, 22 July 2012 (UTC)
I'll try to update it once a month or so. -- [[User:Gerard Schildberger|Gerard Schildberger]] 23:53, 22 July 2012 (UTC)

If somebody else creates a more complete ranking, better filtering program, or an automated version (or more timely), I'll reduce the amount of output of the program and reduce the number of Rosetta Code languages ranked in the REXX '''output''' section. -- [[User:Gerard Schildberger|Gerard Schildberger]] 00:11, 23 July 2012 (UTC)

Revision as of 00:11, 23 July 2012

task clarification

Is it to be assummed that part of the task requirments are to list a certain number of the top ranked Rosetta Code languages? -- Gerard Schildberger 00:02, 23 July 2012 (UTC)

Incorrect examples

ALL examples, except Python "Working Solution" are not working. Please fix. --Guga360 03:49, 29 July 2009 (UTC)

How, exactly, are all other solutions "not working"? Please elaborate. --glennj 10:12, 2 August 2009 (UTC)
Attempting the Python "Working Solution", I'm getting this error using python 2.5.2 --glennj 10:14, 2 August 2009 (UTC)
 $ python rosetta_popular.py
Traceback (most recent call last):
  File "rosetta_popular.py", line 18, in <module>
    for n, i in enumerate(sorted(result,key=lambda x: x[1],reverse=True),start=1):
TypeError: 'start' is an invalid keyword argument for this function
You need Python 2.6. "Not working" examples are only grabbing 500 categories, programming languages like Tcl or Visual Basic don't get in top 10. --Guga360 16:48, 2 August 2009 (UTC)
Actually, the Python implementation isn't correct, either. It omits, for example, AutoHotkey and LotusScript. Compare it with the Perl output. —Underscore 16:16, 30 October 2009 (UTC)
I tried the following:
AutoHotkey is working.
Python is not working
Ruby is not working
TCL webscraping is working
perl wikipedia api has a lot of dependencies, I couldn't get URI to build on my macbook --Tinku99 21:01, 16 May 2010 (UTC)

ALGOL 68

I tested ALGOL 68 (I'm using release algol68g-mk16.win32), but it did not worked. Do I need a library? --Guga360 22:19, 18 April 2009 (UTC)

PS: I'm currently on Windows, i'll try to restart in Ubuntu later.

Error:

39 http content (reply, "www.rosettacode.org", "http://www.rosettacode.org/w /index.php?title=Special:Categories&limit=500", 0); 1 a68g16.exe: error: 1: tag "httpcontent" has not been declared properly (detected in c onditional-clause starting at "IF" in line 37).

I think it's really a library. But i never programmed in ALGOL, what should i do?

Guga360 08:24, 19 April 2009

Hi Guya360,

This ALGOL 68 implementation is an interpretor, and it would require the library being linked into the a68g.exe binary. Hence the .exe you have definitely does not have "http content" linked in.

I ran it on Fedora9 OK. I just checked a68g-manual.pdf and it says:

Mark 8, July 2005

  1. Adds procedure http content for fetching web page contents (UNIX)
  2. Adds procedure tcp request for sending requests via TCP (UNIX)
  3. Adds procedure grep in string for matching regular expressions in a string (UNIX)

The key point being the (UNIX) at the end of the line. I am guessing that the tcp library for windows was enough different from the tcp library for Linux/Unix that the "http content" routine remains both un-ported and broken.

Now I have not tried Algol68g on Ubuntu. I hack around on Fedora. So you MAY be able to use the pre-compiled algol68g RPM for ubuntu (Does Ubuntu support RPMs?)

BUT the algol68g source tar ball will definitely work on ubuntu. (Maybe not on a 64bit Ubuntu as the libraries have moved to /lib64 - if so let me know and I'll sort/hack you up a 64bit update)

The compile should be as easy as installing gcc and configure (and if you need them then install postgres or curses or ... ) then:

tar -xvf /tmp/download/algol68g-mk16.tgz
./configure --threads
make 
# as root
make install
# as user
a68g Sort_most_popular_programming_languages.a68

BTW: you are the first person to feed back on running the ALGOL 68 rosettacode code snippets... I am rather impressed. ThanX - (blush)

Is this snippet the first ALGOL 68 that you have tried?

NevilleDNZ 08:40, 19 April 2009 (UTC)

Yes, it's my first try.
I just found that example intersting because it does not use [[1]].
I compiled algol68g right now. (./configure && make && sudo make install)
It compiled perfectly.
But i runned that example, and nothing happened. It's just "loading".
Any suggestions? --Guga360 16:08, 19 April 2009 (UTC)

I am guessing that you program is running, just really slow, give it 2 minutes to run. Basically the routine re split used to parse the HTML is really slow. re split's performance is the order of O2.

I just recoded the ALGOL 68 version to use a linked list, it is a huge improvement:

[nevilled@november rosettacode]$ time  a68g Sort_most_popular_programming_languages_slow.a68 
1. 233 - Python
2. 222 - Ada
3. 204 - C
4. 203 - OCaml
5. 201 - Perl
6. 193 - Haskell
7. 182 - Java
8. 179 - D
9. 178 - ALGOL 68
10. 160 - Ruby

real	0m47.950s
user	0m44.363s
sys	0m0.080s

[nevilled@november rosettacode]$ time  a68g Sort_most_popular_programming_languages.a68 
1. 233 - Python
2. 222 - Ada
3. 204 - C
4. 203 - OCaml
5. 201 - Perl
6. 193 - Haskell
7. 182 - Java
8. 179 - D
9. 178 - ALGOL 68
10. 160 - Ruby

real	0m11.504s
user	0m3.228s
sys	0m0.068s

Sort_most_popular_programming_languages_slow - the original - would have been issuing thousands of calls to malloc.

re: [[2]] I should/could use this link. I hacked out a solution, c.f. the actual code for the re ignore values.

# hack: needs to be manually maintained #
  STRING re ignore ="Programming Tasks|WikiStubs|Maintenance/OmitCategoriesCreated|"+

Yes... it is a hack. I'll try to stitch this in shortly.

NevilleDNZ 20:04, 19 April 2009 (UTC)


Note: ALGOL 68 for Ubuntu now available

NevilleDNZ 09:19, 17 October 2009 (UTC)

Problem description insufficient?

I updated the Ruby solution today when I noticed there were more than 500 categories. Popular (top 10%) languages like Visual Basic .NET and Vedit macro language are left off most lists. --glennj 20:02, 15 June 2009 (UTC)

I found a better way to do this task.
"http://www.rosettacode.org/w/api.php?action=query&prop=categoryinfo&titles=Category:Python%7CCategory:Tcl%7C...", property "pages" should return category members. --Guga360 21:31, 15 June 2009 (UTC)
I completely missed the Perl/Python solutions: first filter on the Programming_Languages category, not all categories. --glennj
Actually, this does not solve the problem. We're still reading Special:Categories, if there is a language starting with Z, probably it will not get in the list. --Guga360 01:30, 16 June 2009 (UTC)

Ruby example question

I'm trying to run the Ruby example on Ruby 1.8.6 and it says that the "each_slice" method isn't defined. Is that part of 1.8.7? --Mwn3d 19:29, 26 June 2009 (UTC)

I don't know, probably it's for Ruby 1.9, but you can try replace <lang ruby>langs.each_slice(50) do</lang> with <lang ruby>langs[0..50].each do</lang> --Guga360 22:54, 26 June 2009 (UTC)
It's 1.8.7. I'll mark the example. The indexing solution didn't work, but I used a computer that has 1.8.7 and it works. Thanks for the suggestion, though. --Mwn3d 23:18, 26 June 2009 (UTC)
glennj 18:43, 27 June 2009 (UTC) -- Here's what the 1.8.7 docs say about Enumerable#each_slice
Iterates the given block for each slice of <n> elements
It could be implemented like<lang ruby>def each_slice(ary, n)
 (ary.length/n + 1).times {|i| yield ary[i*n,n]}

end</lang>

Redundant task?

I actually asked that on this page on Jan 26, however it was replaced without comment by Guga360. Therefore I'll ask again:

Isn't this task basically a combination of HTTP Request, Regular expression matching and Sorting Using a Custom Comparator? --Ce 11:55, 1 November 2009 (UTC)

Not Redundant — Don't be ridiculous. You might as well argue (by reduction to fundamentals) that it's a combination of basic operations and TCP socket handling. Which it is, but that's missing the whole point. This is a composite task that is focussed on the end goal rather than the specific technique used to achieve it, which is absolutely allowed in the RC rules. –Donal Fellows 13:32, 1 November 2009 (UTC)
BTW, I don't know why Guga360 replaced what you wrote. It seems rather rude to me to do so. –Donal Fellows 13:37, 1 November 2009 (UTC)
There are similarities in the question and answer given here. --Paddy3118 14:47, 1 November 2009 (UTC)
I'll copy the relevant portion of my reply from over there:
As for "redundant" tasks, it doesn't bother me. In fact, I can think of ways to take advantage of it, such as category tagging individual examples with techniques, features or principles they may illustrate, to offer another way to browse and search the site, and to be more illustrative of alternate approaches. (end quote) --Michael Mol 17:16, 1 November 2009 (UTC)


J

The neat thing about the J solution is that it's completely functional/declarative. That is, it contains no imperative code; no instructions on how to process data. It merely describes the result it wants, using four separate domain-specific functional/declarative syntaxes: J, XPath, Regular Expressions, and x2j.

Note: the J solution specifically uses XPath to precisely address the data it wants, rather than relying on a the textual format of the XML (e.g. by assuming the <li> will not break across lines), which is not guaranteed, and defeats the purpose of XML to an extent. The regular expressions are not strictly required; they are included simply to increase legibility (self-documentation) and to identify the data of interest (e.g. by excluding uninteresting <li> in the language list, based on their content).

But this doesn't mean the code is specific to this task (e.g. it doesn't implement a MediaWiki-specific interface). The great value of separating the concerns of addressing (XPath), identifying (regex), and transforming (J) the data is precisely that it is general and adaptable.

This declarative nature also explains why the solution is so concise (relatively). But also it omits the optional join on MostLinkedCategories and washes the list through pattern exclusion.

--DanBron 05:52, 26 November 2009 (UTC)

wanted: a complete list

I would like to see at least one (and probably only one) list to be complete. I also would like it updated, say, every month or quarter so we all can see the current state of all languages, not just the top ten or twenty languages. -- Gerard Schildberger 20:17, 21 March 2012 (UTC)

I tried to execute the Ruby example (with what little I knew of that lanuage), but it didn't execute (got an error) with my version of the Ruby language. I know so little that I don't know if the example depended on a certain version, or maybe the libraries that I have don't contain the necessary routines. In any case, I was hoping that someone could run any of the examples and provide a complete list. -- Gerard Schildberger 21:29, 29 June 2012 (UTC)

One reason to have a complete list is to ensure that the example programs are processing all of the languages (or for the lanuages). That isn't the main reason, but it would/could point out deficiencies in an example's process/algorithm. -- Gerard Schildberger 21:35, 29 June 2012 (UTC)


Since nobody re-ran their examples, I decided to write my own (REXX) and included an almost full list of the rank of languages on Rosetta Code.

I'll try to update it once a month or so. -- Gerard Schildberger 23:53, 22 July 2012 (UTC)

If somebody else creates a more complete ranking, better filtering program, or an automated version (or more timely), I'll reduce the amount of output of the program and reduce the number of Rosetta Code languages ranked in the REXX output section. -- Gerard Schildberger 00:11, 23 July 2012 (UTC)