mirror of
https://github.com/carp-lang/Carp.git
synced 2024-09-17 16:38:14 +03:00
compiler: remove unused variable warning; core: add Statistics usage to Bench, fix ambiguity in Statistics
This commit is contained in:
parent
58f22c8000
commit
a6e44d3c56
@ -1,3 +1,5 @@
|
|||||||
|
(load "Statistics.carp")
|
||||||
|
|
||||||
(system-include "bench.h")
|
(system-include "bench.h")
|
||||||
(register get-time-elapsed (Fn [] Double))
|
(register get-time-elapsed (Fn [] Double))
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
total))))
|
total))))
|
||||||
|
|
||||||
(defn mean [data]
|
(defn mean [data]
|
||||||
(/ (sum data) (from-int (Array.count data))))
|
(/ (Statistics.sum data) (from-int (Array.count data))))
|
||||||
|
|
||||||
(defn min [a]
|
(defn min [a]
|
||||||
(let [m (Double.copy (Array.nth a 0))]
|
(let [m (Double.copy (Array.nth a 0))]
|
||||||
@ -184,7 +184,7 @@
|
|||||||
|
|
||||||
(defn summary [samples]
|
(defn summary [samples]
|
||||||
(Summary.init
|
(Summary.init
|
||||||
(sum samples)
|
(Statistics.sum samples)
|
||||||
(min samples)
|
(min samples)
|
||||||
(max samples)
|
(max samples)
|
||||||
(mean samples)
|
(mean samples)
|
||||||
|
@ -226,6 +226,7 @@ templatePrn pathStrings structTy@(StructTy name varTys) [XObj (Arr membersXObjs)
|
|||||||
, " // convert members to string here:"
|
, " // convert members to string here:"
|
||||||
, " string temp = NULL;"
|
, " string temp = NULL;"
|
||||||
, " int tempsize = 0;"
|
, " int tempsize = 0;"
|
||||||
|
, " (void)tempsize; // that way we remove the occasional unused warning "
|
||||||
, calculateStructStrSize typeEnv env correctedMembers structTy
|
, calculateStructStrSize typeEnv env correctedMembers structTy
|
||||||
, " string buffer = CARP_MALLOC(size);"
|
, " string buffer = CARP_MALLOC(size);"
|
||||||
, " string bufferPtr = buffer;"
|
, " string bufferPtr = buffer;"
|
||||||
@ -260,6 +261,7 @@ templateStr typeEnv env t@(StructTy typeName _) members =
|
|||||||
, " // convert members to string here:"
|
, " // convert members to string here:"
|
||||||
, " string temp = NULL;"
|
, " string temp = NULL;"
|
||||||
, " int tempsize = 0;"
|
, " int tempsize = 0;"
|
||||||
|
, " (void)tempsize; // that way we remove the occasional unused warning "
|
||||||
, calculateStructStrSize typeEnv env correctedMembers structTy
|
, calculateStructStrSize typeEnv env correctedMembers structTy
|
||||||
, " string buffer = CARP_MALLOC(size);"
|
, " string buffer = CARP_MALLOC(size);"
|
||||||
, " string bufferPtr = buffer;"
|
, " string bufferPtr = buffer;"
|
||||||
|
Loading…
Reference in New Issue
Block a user