Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Must use the Scheme language to solve the problem. Thanks! Write a function deep-mult which takes a list as a parameter and computes the product
Must use the Scheme language to solve the problem. Thanks!
Write a function deep-mult which takes a list as a parameter and computes the product of all numbers which appear anywhere in the list or in sublists. We will follow the usual mathematical convention that a product of no numbers is 1 (the multiplicative identity). You may find it useful to know that Scheme has a function number? which returns #t if its argument is numeric atom and #f otherwise.
Examples:
(deep-mult '(5 a b 8 2)) 80 (deep-mult '((4 (6 1)) 2 3 (4))) 576 (deep-mult '(these (aren't 77) (all 32 (numbers 93 here)))) 229152 (deep-mult '()) 1 (deep-mult '(no numbers here)) 1
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started