I am making this Exercises from this page http://www.htdp.org/2003-09-26/Solutions/natnum-list.html
In this code
(define (depth a-dl
(cond
[(symbol? a-dl) 0]
[else (add1 (depth (first a-dl)))]))
We use add1 predefined function which means (+ x 1), I want to swap add1 with (+ x 1) or with lambda. Is it possible? if yes how?
Butt I want not write so outside the function.
(define (add1 x)
(+ x 1))
or so
(define add1
(lambda (x)
(+ x 1)))
(add1 (depth...))with((lambda (x) (+ x 1)) (depth...))or replace the whole call(+ (depth...) 1). These are true refactorings of your code - Sylwester