adapting linear iterative factorial from scheme into ruby