Skip to content

Instantly share code, notes, and snippets.

@shout-poor
Created August 28, 2012 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shout-poor/3498169 to your computer and use it in GitHub Desktop.
Save shout-poor/3498169 to your computer and use it in GitHub Desktop.
SICP Q2.28 Iterative-process
(define (fringe items)
(define (fringe-iter items res)
(cond ((null? items) res)
((pair? (car items))
(fringe-iter (append (car items) (cdr items)) res))
(else
(fringe-iter (cdr items) (cons (car items) res)))))
(reverse (fringe-iter items (list))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment