Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Abelson rated

Name: Anonymous 2012-12-02 12:31

Name: DrRacket/Scheme 2012-12-02 12:43

How do you do this shit /prog/?

Write a Scheme function evens-odds (using at least one abstract list function), which consumes a list of numbers lst and produces the difference between the sum of the odd numbers and the sum of the even numbers in the list lst. Some examples follow:

(evens-odds (list 1 2 3 4)) => -2
(evens-odds empty) => 0 (evens-odds (list 2 4 16)) => -22 (evens-odds (list 1 3 7 21 13)) => 45

 Note: You should use local function(s) only (in case of need).

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List