Rosetta Code/Rank languages by popularity: Difference between revisions

Content added Content deleted
m (→‎REXX program: optimized the program, added suppression on the ranking messages to the terminal.)
m (→‎REXX program: elided the need for the CHANGESTR BIF.)
Line 4,728:
cat.j= space(cat.j); ?= cat.j; upper ? /*remove any superfluous blanks. */
if ?=='' | \L.? then iterate /*it's blank or it's not a language. */
if pos(',', mems)\==0 then mems= changestrspace( translate(mems,,","), mems, ''0) /*elide commas from #.*/
if \datatype(mems, 'W') then iterate /*is the "members" number not numeric? */
#.0= #.0 + mems /*bump the number of members found. */
Line 4,738:
end /*j*/
!.= /*array holds indication of TIED langs.*/
call tell right(commas(#), 9) '(total) number of languages detected in the category file,'
call tell right(commas(langs),9) ' " " " " " " " language " ,'
call tell right(commas(#.0), 9) '(total) number of entries (solutions) detected.', , 1
term= 0 /*don't show any more messages to term.*/
call eSort #,0 /*sort the languages along with number.*/
Line 4,761:
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
commas: procedure;parse arg _; do jjc=length(_)-3 to 1 by -3; _= insert(",",_,jjc); end; return _
/*──────────────────────────────────────────────────────────────────────────────────────*/
eSort: procedure expose #. @. !tr.; arg N,p2; h= N /*sort: number of members*/
Line 4,784:
old.1= '╬£C++' ; new.1= "µC++" /*Unicode ╬£C++ ───► ASCII─8: µC++ */
old.2= 'UC++' ; new.2= "µC++" /*old UC++ ───► ASCII─8: µC++ */
old.3= '╨£╨Ü-' ; new.3= "MK-" /*Unicode ╨£╨Ü-╨Ü─ ───► ASCII─8ASCII-8: MK- */
old.4= 'D├⌐j├á' ; new.4= "Déjà" /*Unicode ├⌐j├á ───► ASCII─8: Déjà */
old.5= 'Cach├⌐' ; new.5= "Caché" /*Unicode Cach├⌐ ───► ASCII─8: Caché */
Line 4,799:
end /*v*/ /* [↑] handle different lang spellings*/
if igAst then do; igAst= pos(' * ',$)==0; if igAst then iterate; end
$$u = $$; upper $$u /*define uppercase version of $$*/
if pos('RETRIEVED FROM',$$u)\==0 then leave /*is this a pseudo End─Of─Data? */
if which=='L' then do
Line 4,816:
s: if arg(1)==1 then return arg(3); return word(arg(2) 's',1) /*pluralizer.*/
/*──────────────────────────────────────────────────────────────────────────────────────*/
tell: do '0'arg(2); call lineout outFID," " ; if term then say; ; end
call lineout outFID,arg(1) ; ; if term then say arg(1)
do '0'arg(3); call lineout outFID," " ; if term then say; ; end
return /*show BEFORE blank lines (if any), message, show AFTER blank lines.*/</lang>
Some older REXXes don't have a &nbsp; '''changestr''' &nbsp; BIF, &nbsp; so one is included here: &nbsp; ───► &nbsp; [[CHANGESTR.REX]].
<br><br>
 
===all ranked 723 languages===