CompileList.scm

This code (written in Scheme) is a recursive function that returns a list containing integers 0...num. The function call underneath it is an example of how it works.

#lang scheme

(define (compileList num lst)
  (cond
    [(= num -1) lst]
    [else (compileList (- num 1) (append (list num) lst))]))

; call the function
(compileList 5 empty) ; (0 1 2 3 4 5)
DOWNLOAD

              Created: September 6, 2014
Completed in full by: Michael Yaworski