Skip to content

Instantly share code, notes, and snippets.

@mauricio
Created November 5, 2013 04:21
Show Gist options
  • Select an option

  • Save mauricio/7313832 to your computer and use it in GitHub Desktop.

Select an option

Save mauricio/7313832 to your computer and use it in GitHub Desktop.
#lang racket
(define (sum xs)
(cond
[(null? xs) 0]
[(number? xs) xs]
[(list? xs) (+ (sum (car xs)) (sum (cdr xs))) ]
[#t 0]
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment