;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Compulsory Exercise 0. Complete by Thursday 16th October at 13.00 hours ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; define the following functions (define (min-list l) 'define-me); deliver the smallest element in list l; hint, look at apply (define (median-list l) 'define-me) ; deliver the median of the list l ; where median is the value that splits the population ; in half. Note: you might use functions sort and list-ref (define (max-list l) 'define-me); deliver the largest element in list l (define (mean-list l) 'define-me); deliver the mean of the list (define (stdev-list l) 'define-me); deliver the standard deviation of the list l (define (stats l) (list (min-list l) (median-list l) (max-list l) (mean-list l) (stdev-list l))); deliver a 5-tuple statistic ;;; Test out your functions on randomly generated data read from file ;;; That is use function write-random-data to write random numbers to ;;; a file, then use file->list to get that data, then do stats on it. ;;; Se io.scm for these functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; (much) more advanced and optional (define (ps s) 'define-me); where s is a set of values (as a list) ; sample output is as below ;> (ps '(1 2 3)) ;Evaluation took 0 mSec (0 in gc) 173 cells work, 37 bytes other ;((1 2 3) (1 2) (1 3) (1) (2 3) (2) (3) ()) ;> (ps '(send more money)) ;Evaluation took 0 mSec (0 in gc) 158 cells work, 47 bytes other ;((send more money) (send more) (send money) (send) ; (more money) (more) (money) ()) ;> (define (cp lists) 'define-me) ; where lists is a list of lists ; sample output below ;> (cp '((1 2) (a b))) ;Evaluation took 0 mSec (0 in gc) 140 cells work, 35 bytes other ;((1 a) (1 b) (2 a) (2 b)) ;> (cp '((1 2) (a b) (dog cat mouse))) ;Evaluation took 0 mSec (0 in gc) 343 cells work, 49 bytes other ;((1 a dog) (1 a cat) (1 a mouse) ; (1 b dog) (1 b cat) (1 b mouse) ; (2 a dog) (2 a cat) (2 a mouse) ; (2 b dog) (2 b cat) (2 b mouse))