Rebol3 Code Examplex
Rosetta Code/Rank languages by popularity
Rank programming languages by their Rosetta Code presence.
Rebol [
title: "Rosetta code: Rosetta Code/Rank languages by popularity"
file: %Rosetta_Code-Rank_languages_by_popularity.r3
url: https://rosettacode.org/wiki/Rosetta_Code/Rank_languages_by_popularity
]
get-lang-popularity: function [
"Scrapes Rosetta Code to rank programming languages by number of task solutions"
][
base-url: https://rosettacode.org/wiki/Category:Programming_Languages
que: to block! base-url ;; Initialize queue with the starting URL
data: copy [] ;; Will hold [language pages language pages ...] pairs
;; Process each URL in the queue (handles pagination across subcategory pages)
while [not empty? que][
;; Dequeue and read the next URL
url: take que
print ["Reading:" as-blue url]
html: read/string url
;; Truncate the HTML at the page content section we don't need,
;; so the parser doesn't accidentally match links in the page footer
clear find html <div id="mw-pages">
next-cat: none ;; Will hold the "next page" subcategory token, if present
parse html [
;; Jump to the subcategories section of the page
thru <div id="mw-subcategories">
;; Optionally capture the pagination token for the next batch of subcategories
opt [
thru {<a href="/wiki/Category:Programming_Languages?subcatfrom=}
copy next-cat: to #"^""
]
;; Iterate over every language subcategory entry on this page
any [
thru {<bdi dir="ltr"><a href="}
copy cat-url: to #"^""
thru {title="Category:}
copy cat-ttl: to #"^""
thru {title="Contains }
copy contains: to #"^""
(
;print [pad copy cat-ttl -25 contains]
if parse contains [thru ", " copy pages: to SP to end][
replace/all pages #"," ""
repend data [cat-ttl to integer! pages]
]
)
]
]
;; If a next-page token was found, enqueue the continuation URL
if next-cat [
append que rejoin [base-url %?subcatfrom= next-cat]
]
]
;; Return the sorted [lang pages lang pages ...] block by page count, descending
sort/skip/compare/reverse data 2 2
]
;; --- Display Top 100 ---
data: get-lang-popularity ;; Fetch and rank all languages
n: 1 ;; Rank counter
print "Rosetta Code top 100 languages by tasks solved:"
foreach [language pages] data [
if n > 100 [break] ;; Stop after the top 100
;; Print rank, language name (highlighted), and solution count
print ajoin [
pad n -3 ". " as-yellow language " (" pages ")"
if language = "Rebol" [" 👈👈👈👈👈👈👈👈👈"]
]
++ n
]
;; Timestamp when the data fetch completed
print ["Data received:" as-green now]
Output:
Reading: https://rosettacode.org/wiki/Category:Programming_Languages
Reading: https://rosettacode.org/wiki/Category:Programming_Languages?subcatfrom=CORESCRIPT%0ACorescript#mw-subcategories
Reading: https://rosettacode.org/wiki/Category:Programming_Languages?subcatfrom=IS-BASIC%0AIS-BASIC#mw-subcategories
Reading: https://rosettacode.org/wiki/Category:Programming_Languages?subcatfrom=NSIS%0ANSIS#mw-subcategories
Reading: https://rosettacode.org/wiki/Category:Programming_Languages?subcatfrom=SIL%0ASIL#mw-subcategories
Rosetta Code top 100 languages by tasks solved:
1. Wren (1758)
2. Phix (1756)
3. Julia (1755)
4. FreeBASIC (1731)
5. Raku (1708)
6. Python (1685)
7. Java (1653)
8. Perl (1627)
9. Nim (1625)
10. Go (1623)
11. C++ (1485)
12. J (1417)
13. C (1352)
14. Mathematica (1332)
15. Ruby (1254)
16. Rust (1233)
17. Haskell (1211)
18. Jq (1205)
19. REXX (1196)
20. Kotlin (1187)
21. ALGOL 68 (1144)
22. EasyLang (1114)
23. Racket (1110)
24. JavaScript (1102)
25. Ada (1095)
26. C sharp (1091)
27. Sidef (1076)
28. Lua (1035)
29. 11l (1016)
30. Zkl (1012)
31. D (1006)
32. Tcl (1005)
33. Factor (1004)
34. Scala (985)
35. XPL0 (967)
36. Pluto (962)
37. Delphi (951)
38. F Sharp (904)
39. Fortran (891)
40. R (889)
41. Ring (857)
42. PicoLisp (847)
43. AutoHotkey (827)
44. Arturo (815)
45. RPL (815)
46. Common Lisp (788)
47. AWK (772)
48. Pascal (763)
49. FutureBasic (761)
50. PureBasic (755)
51. Quackery (755)
52. YAMLScript (750)
53. BASIC (740)
54. OCaml (695)
55. Unicon (682)
56. V (Vlang) (676)
57. Clojure (648)
58. Swift (646)
59. Forth (643)
60. Icon (628)
61. PARI/GP (626)
62. PascalABC.NET (623)
63. BBC BASIC (591)
64. Rebol (588) 👈👈👈👈👈👈👈👈👈
65. Yabasic (585)
66. Crystal (579)
67. M2000 Interpreter (577)
68. Uiua (564)
69. Elixir (551)
70. Erlang (541)
71. Action! (540)
72. PowerShell (527)
73. Prolog (527)
74. AppleScript (515)
75. BASIC256 (511)
76. PHP (505)
77. Groovy (503)
78. Seed7 (476)
79. PL/I (459)
80. Scheme (452)
81. Maxima (422)
82. VBA (417)
83. MATLAB (416)
84. COBOL (412)
85. Maple (406)
86. Visual Basic .NET (405)
87. Run BASIC (404)
88. Liberty BASIC (370)
89. UNIX Shell (367)
90. VBScript (359)
91. Objeck (357)
92. ALGOL W (355)
93. Applesoft BASIC (352)
94. Picat (335)
95. APL (334)
96. Zig (331)
97. Zen C (328)
98. Octave (327)
99. Smalltalk (326)
100. BQN (310)
Data received: 15-Jul-2026/0:21:42+2:00