Welcome to DrScheme, version 205. Language: Standard (R5RS). > (if (< 3 5) 3 5) 3 > (define (min a b) (if (< a b) a b)) > (min 3 5) 3 > (min 7 3) 3 > (min 1 -3) -3 > (cond ((< 3 5) 3) ((< 2 6) 4) (else 1)) 3 > (define (signum x) (cond ((> x 0) 1) ((< x 0) -1) (else 0))) > (signum 3) 1 > (signum -7) -1 > (signum 0) 0 ;;; Higher-order function examples ;;; -- passing functions as arguments... > (define (double x) (* x 2)) > double # > (double 3) 6 > (define (f g x) (g x)) > (f double 3) 6 > double # > ;;; -- functions as "return values" > (define (make-addk k) (lambda (x) (+ k x))) > ((make-addk 3) 5) 8 > (make-addk 3) # ;; Each of these three definitions of add3 are equivalent (in that ;; add3 is defined as a function that adds 3 to its argument ;; These first two are the normal way (the first uses the shorthand) > (define (add3 x) (+ x 3)) > (define add3 (lambda (x) (+ x 3))) ;; This uses the make-addk function that returns a function > (define add3 (make-addk 3)) > (add3 5) 8