diff --git a/CHANGELOG.md b/CHANGELOG.md index f62d1921..7a4bbd71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ All notable changes to this project will be documented in this file. ## Unreleased +- Fix an issue that prevent some valid programs from compiling. +- Add `mean` to core. - Allow (length x) on typed arrays an other abstract types that implement the :length method. diff --git a/src/boot/boot.janet b/src/boot/boot.janet index 7fde2028..bd0630f3 100644 --- a/src/boot/boot.janet +++ b/src/boot/boot.janet @@ -445,6 +445,11 @@ (each x xs (+= accum x)) accum) +(defn mean + "Returns the mean of xs. If empty, returns NaN." + [xs] + (/ (sum xs) (length xs))) + (defn product "Returns the product of xs. If xs is empty, returns 1." [xs]