Annotation of 43BSD/contrib/icon/port/cross.icn, revision 1.1

1.1     ! root        1: #
        !             2: #          W O R D   I N T E R S E C T I O N S
        !             3: #
        !             4: 
        !             5: #  This program procedure accepts string pairs from standard input, with
        !             6: #  the strings separated by semicolons.  It then diagrams all the
        !             7: #  intersections of the two strings in a common character.
        !             8: 
        !             9: procedure main()
        !            10:    local line, j
        !            11:    while line := read() do {
        !            12:       write()
        !            13:       j := upto(':',line)
        !            14:       cross(line[1:j],line[j+1:0])
        !            15:       }
        !            16: end
        !            17: 
        !            18: procedure cross(s1,s2)
        !            19:    local j, k
        !            20:    every j := upto(s2,s1) do
        !            21:       every k := upto(s1[j],s2) do
        !            22:          xprint(s1,s2,j,k)
        !            23: end
        !            24: 
        !            25: procedure xprint(s1,s2,j,k)
        !            26:    write()
        !            27:    every write(right(s2[1 to k-1],j))
        !            28:    write(s1)
        !            29:    every write(right(s2[k+1 to *s2],j))
        !            30: end

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.