Pure Programmer
Blue Matrix


Cluster Map

Project: Frequency Table (Bytes)

Write a program to generate a table of frequencies. The program should accept a stream on stdin and total the number of each byte seen. Once the stream has been read the program should print a tab-delimited table with columns for Byte Value (decimal), Byte Value (hexadecimal), Count, and Frequency. The frequency of each byte is the count for that byte divided by the total number of bytes in the file. Only print rows in the table for values with a byte count greater than 0.

Output
$ swiftc FrequencyTableBytes.swift -I . -L . -lUtils error: link command failed with exit code 1 (use -v to see invocation) ld: library not found for -lUtils clang: error: linker command failed with exit code 1 (use -v to see invocation) $ swiftc FrequencyTableBytes.swift -I . -L . -lUtils error: link command failed with exit code 1 (use -v to see invocation) ld: library not found for -lUtils clang: error: linker command failed with exit code 1 (use -v to see invocation) $ swiftc FrequencyTableBytes.swift -I . -L . -lUtils error: link command failed with exit code 1 (use -v to see invocation) ld: library not found for -lUtils clang: error: linker command failed with exit code 1 (use -v to see invocation)

Solution