scheme | functional programming – CSCI 3136: Assignment 6

CSCI 3136: Assignment 6

scheme – 本题是一个利用scheme进行练习的代做, 对scheme的流程进行训练解析, 包括了scheme等方面

scheme代写 代做scheme

Tami Meredith, Summer 2022

Write scheme programs to accomplish each of the following. You may not use loops or any built-in procedure name that ends with !. Do not use the display procedure. Submit your results, on Brightspace, as a single file named a6.scm. Your submissions should obey good programming style (e.g., comments, indentation, use of whitespace).

  1. [5 marks] Sum a list of integers.
Example: (list-sum (1 11 3 7 9))  31
  1. [5 marks] Find the mean of a list of integers.
Example: (mean (1 11 3 7 9))  6.
  1. [10 marks] Determine if a list is flat (i.e., contains no sub-lists).
Example: (flat? (1 11 (2 3) 4 8))  #f
  1. [10 marks] Find the maximum integer in a list of integers.
Example: (list-max (1 11 3 7 9))  11
  1. [10 marks] Search a non-flat list to determine if a value is there.
Example: (in-list? a (7 a (b (c a)) () (d d)))  #t
  1. [10 marks] Determine if a list of integers is in ascending order.
Example: (sorted? (- 1 1 2 3 7 9))  #t