mirror of
https://github.com/carp-lang/Carp.git
synced 2024-09-11 05:25:28 +03:00
Fix tests on memory.carp, Modify Statistics module as Veit Heller
sugested
This commit is contained in:
parent
bfd80fd4af
commit
353f8470ed
@ -5,8 +5,8 @@
|
||||
(defmodule Statistics
|
||||
(deftype Summary [
|
||||
sum Double,
|
||||
min (Maybe Double),
|
||||
max (Maybe Double),
|
||||
min Double,
|
||||
max Double,
|
||||
mean Double,
|
||||
median Double,
|
||||
var Double,
|
||||
@ -177,8 +177,8 @@
|
||||
(defn summary [samples]
|
||||
(Summary.init
|
||||
(Array.sum samples)
|
||||
(Array.minimum samples)
|
||||
(Array.maximum samples)
|
||||
(Maybe.from (Array.minimum samples) 0.0)
|
||||
(Maybe.from (Array.maximum samples) 0.0)
|
||||
(mean samples)
|
||||
(median samples)
|
||||
(variance samples)
|
||||
|
@ -231,11 +231,11 @@
|
||||
|
||||
(defn array-maximum []
|
||||
(let [xs [1 7 2 9 3 8 4 6 5]]
|
||||
(assert (= (Maybe.Just 9) (maximum &xs)))))
|
||||
(assert (= &(Maybe.Just 9) &(maximum &xs)))))
|
||||
|
||||
(defn array-minimum []
|
||||
(let [xs [8 4 6 5 1 7 2 9 3]]
|
||||
(assert (= (Maybe.Just 1) (minimum &xs)))))
|
||||
(assert (= &(Maybe.Just 1) &(minimum &xs)))))
|
||||
|
||||
(defn array-sum []
|
||||
(let [xs [10 20 30 40 50]]
|
||||
|
Loading…
Reference in New Issue
Block a user