Implemented `dec2int` using foldl