Consider this iterative factorial procedure from SICP.
(define (fact-iter product counter max-count)
(if (> counter max-count)
product
(fact-iter (* counter product)
(+ counter 1)
max-count)))
Here, we see:
- The declaration of factorial doesn't have leading spaces. I think that's normal.
- The body of the function requires two leading spaces each line.
- we add four spaces at the first clause and the beginning of the second clause of the if statement. In total 6 spaces.
- We add 11 more spaces in the last two lines, the rest of the second clause of the if statement. In total 17 spaces.
Why is it like this? The spacing is confusing to me. Why can't it be like java (add four spaces in every inner part of code)? How should I format lisp code?