As an exercise to learn Haskell, I wrote a specialized grep to work on sorted files. It uses binary search to scan a text file and print all the (consecutive) lines that start with a user defined string.
My program is a rewrite of sgrep in Haskell: I called it HSGrep.
Code is available on github.
Thanks a lot for all your useful suggestions! As soon as possible, I’ll post some benchmarking here. (EDIT: benchmarks now available!)
After downloading the source code, build installĀ and run it with:
$> cabal build $> cabal install $> hslint <string> <filename>
{ 1 } Trackback
[...] days ago, I rewrote sgrep in Haskell. I was curious to know how it compares to grep in term of execution speed. In particular, I was [...]
Post a Comment