Huffman tree generator in Prolog