Skip to content

Instantly share code, notes, and snippets.

@grevych
Last active September 24, 2021 09:47
Show Gist options
  • Save grevych/2b353a9302b715f57084b7564519d131 to your computer and use it in GitHub Desktop.
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
(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