Hello,

I was wondering if argument coercion is implemented, or if the docs are 
early?

I can't get

     procedure testing(i:integer:1)
         write(i)
     end

to work.

     try.icn:24: # "i": syntax error (247;366)

I'm running a local build of rev 4430.

Just curious.

Are string form procedure calls supposed to work?

     s := "testing"
     s(4)

Comes up with a runtime error 106.  Again, just curious.


And one last issue, the Rosetta Code entry for the Rank by popularity 
seems busted

http://rosettacode.org/wiki/Rosetta_Code/Rank_languages_by_popularity#Icon_and_Unicon

I think the output format changed, so that sample is only picking up the 
first 500 entries, and missing out on the continue page.

I have a local version that looks like

########
$define RCLANGS 
"http://rosettacode.org/mw/api.php?format=xml&action=query&generator=categorymembers&gcmtitle=Catego↪ry:Programming%20Languages&gcmlimit=500&prop=categoryinfo";
$define RCUA    "User-Agent: Unicon Rosetta 0.1"
$define RCXUA   "X-Unicon: http://unicon.org/";

link strings
link hexcvt

procedure main()
     cnt := create seq()
     last := -1
     every pair := !reverse(sort(langs := tallyPages(),2)) do {
         n := if last ~=:= pair[2] then @cnt else (@cnt,"")
         write(right(n,4),": ",left(pair[1],30,". "),right(pair[2],10,". 
"))
         }
     write(*langs, " languages")
end

# Generate page counts for each language
procedure tallyPages(url)
     /url := RCLANGS
     counts := table()
     continue := ""
     while \(txt := ReadURL(url||continue)) do {
         txt ? {
             if tab(find("gcmcontinue=")) then {
                 continue := "&"||tab(upto('"'))
                 move(1)
                 continue ||:= tab(upto('"'))
                 }
             else continue := ""
             while tab(find("<page ") & find(s := 
"title=\"Category:")+*s) do {
                 lang := tab(upto('"'))
                 tab(find(s := "pages=\"")+*s)
                 counts[lang] := numeric(tab(upto('"')))
                 }
             if continue == "" then return counts
             }
         }
end

procedure ReadURL(url)                 #: read URL into string
     page := open(url,"m",RCUA,RCXUA) | stop("Unable to open ",url)
     text := ""
     if page["Status-Code"] < 300 then while text ||:= reads(page,-1)
     else write(&errout,image(url),": ",
                        page["Status-Code"]," ",page["Reason-Phrase"])
     close(page)
     return text
end
########

That version allows for Unicon to be included in the list at least.  :-)

The existing entry seems to assume the gcmcontinue output occurs after 
the list, but when I tried it, that xml line seems to occur before the 
Category page counts, so the existing entry never scans the gcmcontinue 
tag.

But, I'm too new in my "Icon refresher to get up to speed on Unicon" 
pass to feel comfortable updating the entry on Rosetta; the gcmcontinue 
string scanning feels less optimal than it could be, so I'd like to ask 
the august members of this list to look it over and critique first.

Some Unicode names causing the output dots to look less than perfect is 
another thing, but that's just visual and not incorrect counts, so that 
seems quite a bit less important than the Unicon pop-count routine not 
including Unicon in the output.

Liking the work you've done on Unicon everyone, well done.  Having a lot 
of fun writing up exploratory code fragments.

I'm hoping to be able to submit a Pygments code highlighter for 
Icon/Unicon to team Pocoo over the next few days.  I write documentation 
with Sphinx and ReStructuredText and that system needs a Pygments lexer 
to get colour code blocks.  If/when that happens, I might pester the 
Unicon admin team to open up the Discussion feature on SourceForge.  
They use Pygments with the Allura engine and it sure is nice seeing code 
in colour.  I help manage the GnuCOBOL project on the forge and colour 
listings really do add to the conversation.  But that's future talk; the 
proof in that pudding will be when team Pocoo accepts the lexer.

Cheers,
Brian

------------------------------------------------------------------------------
_______________________________________________
Unicon-group mailing list
Unicon-group@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/unicon-group

Reply via email to