Scheme Deep reverse function -


i doing scheme program takes in list , reverse it. far works simple list, not contain sublist, when test list contains sublist, fails. please me wrong it. here code:

(define deep-reverse   (lambda (l)     (cond       ((empty? l) '())       (else (append (deep-reverse (rest l)) (list (first l))))))) 

(define (deeprev l)           (if (null? l) '()               (if (list? (car l))                   (if (chek (car l)) (append (deeprev (cdr l)) (list (reverse (car l))))                            (append (deeprev (cdr l)) (list (deeprev (car l)))))                   (append (deeprev (cdr l)) (list (car l)))))) 

Comments

Popular posts from this blog

400 Bad Request on Apache/PHP AddHandler wrapper -

Add email recipient to all new Trac tickets -

php - Change action and image src url's with jQuery -