Skip to content

Instantly share code, notes, and snippets.

@cmpitg
Created August 11, 2012 13:29
Show Gist options
  • Save cmpitg/3324442 to your computer and use it in GitHub Desktop.
Save cmpitg/3324442 to your computer and use it in GitHub Desktop.
(defun suml (lst res)
(if (zerop (list-length lst))
res
(suml (rest lst) (+ res (first lst)))))
(suml '(1 2 3 4 5) 0)
@cmpitg
Copy link
Author

cmpitg commented Aug 14, 2012

res là "result" mà bạn. Bạn đọc kỹ lại nhé, rest với res là khác nhau đấy nhé.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment