SCHEME LANGUAGE
Scheme program for a grocery store that will calculate the totalprice of a customer’s items, represented as a list. Recursively going through the list using those defines to calculatethe sum as below. Will that work and why? What should be corrected?
(define milk 2.99)(define chicken 7.99)(define carrots 1.99)(define add-cart (lambda(x) (if (empty? x) 0 (+ (car x) (add-cart(cdr x))))))(add-cart '(milk chicken carrots))
SCHEME LANGUAGE Scheme program for a grocery store that will calculate the total price of a customer’s items, represente
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
SCHEME LANGUAGE Scheme program for a grocery store that will calculate the total price of a customer’s items, represente
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!