In the scheme, when a list is defined as ((item number a unit price a purchase number a) (item number b unit price b purchase number b) ...),
How should I describe the function to find the sum of the unit price of this number of purchases?
I know how to pass the list to the arguments of the function, but I don't know how to write how to take out the list and calculate the sum.
scheme
The following is how to use cadr
and apply
.
(define lst'((110010)(22505)(35003))))
(apply+(map cadrlst))
=>
850
368 FileNotFoundError in json: What is the difference between these two?
368 I want to change the format (date and time display) of the legend in chronological order.
356 Where is the memory area of the reference static variable in c#?
362 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
© 2023 OneMinuteCode. All rights reserved.