You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

#### 64 lines 1.8 KiB Raw Blame History

 `(newline)` `(display " ---------------")(newline)` `(display " Exercise 2.41")(newline)` `(display "-----------------------------------------------------------")(newline)` `; -- Defs --` `(define nil ())` `(define (accumulate op initial sequence)` ` (if (null? sequence)` ` initial` ` (op (car sequence)` ` (accumulate op initial (cdr sequence)))))` `; -- Start --` `(define (flatmap proc seq)` ` (accumulate append nil (map proc seq)))` `; --------` ``` ``` `; Star exercise 2.41` `(display " Write a pro cedure to find all ordered triples")(newline)` `(display " of distinct positive integers i, j and k")(newline)` `(display " less than or equal to a given interger n")(newline)` `(display " that sum to a given integer s")(newline)` `(display "-----------------------------------------------------------")(newline)` `(newline)` `(define (seq start stop)` ` (if (> start stop)` ` (list)` ` (cons start (seq (+ start 1) stop))))` ``` ``` `; unique-pairs n -> [ (i,j) | 1<=i