I guess that if i reply to myself that is a form of recursion.
Geoffrey here is the other way i wrote the function.
(define ele-1 (first poly-1))
(define (add-to-end-1 a-poly)
(cond
((empty? (rest a-poly)) (cons (first a-poly) (cons ele-1 empty)))
(else
(cons (first a-poly) (add-to-end-1 (rest a-poly))))))
If i define ele-1 outside the body of the function it works; but that
does
not seem elegant; so is there a way of defining ele-1 inside the body
of the
function? here is the implementation .
(add-to-end-1 poly-1)
(cons
(make-posn 10 10)
(cons (make-posn 60 60) (cons (make-posn 10 60) (cons (make-posn 10
10) empty))))
> poly-1
(cons (make-posn 10 10) (cons (make-posn 60 60) (cons (make-posn 10
60) empty)))
> So in the present form i must always redefine ele-1 outside the function body
ps i hope i am not overlooking something very obvious !!
thanks for our input
mike