Created
March 10, 2017 07:51
-
-
Save quang-m-nguyen/f0f4fa37f35b0e7c55a22afa99687685 to your computer and use it in GitHub Desktop.
null created by quangogster - https://repl.it/GP0j/1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (addup L) (cond | |
((null? L) 0) | |
(else (+ (car L) (addup (cdr L))) ) ) | |
) | |
(define (deepSum L) (cond | |
((null? L) 0) | |
((null? (car L))(+ 0 (deepSum (cdr L)))) | |
((pair? (car L)) (+ (addup (car L)) (deepSum (cdr L)))) | |
(not (list? (car L))(+ (car L) (deepSum (cdr L)))) | |
(else (+ (car L) (deepSum (cdr L))) ) | |
)) | |
(deepSum '(1 (2 3 4) (5) 6 7 (8 9 10) 11)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
my god lol