~vcs-imports/gawk/master

« back to all changes in this revision

Viewing changes to awklib/eg/prog/anagram.awk

Update README.solaris.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# anagram.awk --- An implementation of the anagram-finding algorithm
2
 
#                 from Jon Bentley's "Programming Pearls," 2nd edition.
 
1
# anagram.awk --- An implementation of the anagram finding algorithm
 
2
#                 from Jon Bentley's "Programming Pearls", 2nd edition.
3
3
#                 Addison Wesley, 2000, ISBN 0-201-65788-0.
4
4
#                 Column 2, Problem C, section 2.8, pp 18-20.
5
5
#
9
9
#   - split() with "" as separator splits out individual characters
10
10
#   - asort() and asorti() functions
11
11
#
12
 
# See https://savannah.gnu.org/projects/gawk.
 
12
# See http://savannah.gnu.org/projects/gawk.
13
13
#
14
14
# Arnold Robbins
15
15
# arnold@skeeve.com
21
21
    key = word2key($1)  # Build signature
22
22
    data[key][$1] = $1  # Store word with signature
23
23
}
24
 
# word2key --- split word apart into letters, sort, and join back together
 
24
# word2key --- split word apart into letters, sort, joining back together
25
25
 
26
26
function word2key(word,     a, i, n, result)
27
27
{