LZW compression implementation with Scala