I can write the recursion version correctly need help with writing a do loop in DrScheme.

After the do loop the variable x is sent to car L intially and then is updated to first element of everything but first element in list.

(define (sumiteration L)
  (do ((x (car L) (car(cdr L))))
    ((null? L))
    (set! sum (+ sum x)))
)

Recommended Answers

All 6 Replies

Did you mean to post this in CompSci?

Moved...

delete one of the threads since i posted it here. doesn't matter which one.

some one please help I am really confused!! :(

(define (sumiteration L)
(do ((sum 0)
)
((null? L) suma)
(set! sum (+ sum (car L)))
(set! L (cdr L))
)
)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.