TEST 19/B

matricola: ______________________________

nome (solo se non si ricorda la matricola): __________________________________


Define a Scheme function that takes as input two natural numbers n and m such that n<=m, and a predicate P? on numbers. It returns the sum
of all numbers berween n and m that satisfy the predicate P?.











Definirea Scheme function that takes a list ls as input and returns the list of the elements of ls in even position.
Example:  (F (list 5 6 5 6 5 6))   ---->   (5 5 5)













Define a Scheme function taking as input a list ls and a predicate P? on its elements, and which returns a list of two lists: the list of the elements of ls satisfying P? and the list of the elements of ls which do not satisfy P?.                                                      Example: (F (list 1 2 3 4 5 6 7) even?) --> ((2 4 6) (1 3 5 7)