How to resolve the algorithm Rosetta Code/Rank languages by popularity step by step in the J programming language

Published on 12 May 2024 09:40 PM
#J

How to resolve the algorithm Rosetta Code/Rank languages by popularity step by step in the J programming language

Table of Contents

Problem Statement

Sort the most popular computer programming languages based in number of members in Rosetta Code categories. Sample output on 02 August 2022 at 09:50 +02

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Rosetta Code/Rank languages by popularity step by step in the J programming language

Source code in the j programming language

require 'web/gethttp xml/sax/x2j regex'

x2jclass 'rcPopLang'

rx         =:  (<0 1) {:: (2#a:) ,~ rxmatches rxfrom ]

'Popular Languages' x2jDefn
   /                             :=  langs  : langs =: 0 2 $ a:
   html/body/div/div/div/ul/li   :=  langs =: langs ,^:(a:~:{.@[)~ lang ;  ' \((\d+) members?\)' rx y
   html/body/div/div/div/ul/li/a :=  lang  =: '^\s*((?:.(?!User|Tasks|Omit|attention|operations|by))+)\s*$' rx y
)

cocurrent'base'

sortTab    =.  \: __ ". [: ;:^:_1: {:"1
formatTab  =:  [: ;:^:_1: [: (20 A. (<'-') , |. , [: ('.' <"1@:,.~ ":) 1 + 1 i.@,~ 1{$)&.|: sortTab f.

rcPopLangs =:  formatTab@:process_rcPopLang_@:gethttp


   10 {. rcPopLangs 'http://www.rosettacode.org/w/index.php?title=Special:Categories&limit=2000'
   1. 687 - Tcl                                                           
   2. 646 - Python                                                        
   3. 637 - C                                                             
   4. 626 - PicoLisp                                                      
   5. 612 - J                                                             
   6. 587 - Go                                                            
   7. 556 - Ada                                                           
   8. 550 - D                                                             
   9. 549 - Mathematica                                                   
  10. 526 - Perl


  

You may also check:How to resolve the algorithm Sorting algorithms/Merge sort step by step in the Clojure programming language
You may also check:How to resolve the algorithm Loops/Continue step by step in the MAXScript programming language
You may also check:How to resolve the algorithm Largest number divisible by its digits step by step in the Clojure programming language
You may also check:How to resolve the algorithm General FizzBuzz step by step in the OCaml programming language
You may also check:How to resolve the algorithm 100 doors step by step in the SenseTalk programming language