Using fold to calculate factorial