and
a function to compute the average(mean) of a list of numbers
(This newsgroup is kind of deprecated. Try: comp.lang.lisp)
> how do i define a function to add up numbers in a list???
In Common-Lisp:
(defun add-up (list)
(reduce (function +) list))
> and
>
> a function to compute the average(mean) of a list of numbers
(defun average (list)
(and list
(/ (reduce (function +) list) (length list))))
--
__Pascal Bourguignon__ http://www.informatimago.com/
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS d? s++:++ a+ C+++ UL++++ P--- L+++ E+++ W++ N+++ o-- K- w---
O- M++ V PS PE++ Y++ PGP t+ 5+ X++ R !tv b+++ DI++++ D++
G e+++ h+ r-- z?
------END GEEK CODE BLOCK------