racket Recursion Using define


Example

#lang racket
(define (sum-of-list l)
  (if (null? l)
      0
      (+ (car l)
         (sum-of-list (cdr l)))))
(sum-of-list '(1 2 3 4 5)) ;; => 15