imrpove truth table apperance && use foldl to replace hand-made recursive method