Last active
September 24, 2021 09:47
-
-
Save grevych/2b353a9302b715f57084b7564519d131 to your computer and use it in GitHub Desktop.
Write a function in racket that receives a list of lists of numbers and return the product of all the elements in the lists
This file contains 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 (FUNO L) | |
(cond | |
[(list? L) | |
(cond | |
[(empty? L) 1] | |
[(equal? (length L) 1) (FUNO(first L))] | |
[(* (FUNO(first L)) (FUNO (rest L)))] | |
) | |
] | |
[else L] | |
) | |
) | |
(write(FUNO '(10 (8 (1) (1)) (20 (1) (1)))) ) #1600 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment