I'm playing around with writing some code in scheme. Here's an example of doing a fibonacci:
(define (fib n)
; if n == 0:
(if (= n 0)
; return 0
0
; else if n==1
(if (= n 1)
; return 1
1
; else return fib(n-1) + fib(n-2)
(+ (fib (- n 1)) (fib (- n 2)))))
)
(fib 4)
(fib 3)
(fib 2)
(fib 1)
(fib 0)
3
2
1
1
0
My question is more about general advice. How in the world do you keep track of all the parentheses? It's not so much a matter of legibility (I don't care about that) but more just a matter of getting things right and not having to do trial-and-error in ten difference places to add in extra parens to see if things work when it's all said and done.
Is there a good way to get a better handle on the parens, such as a good IDE or web environment or what-not, or is the answer just "get used to it". ?