import type { Reducer } from "./api.js" ; import { $$reduce } from "./reduce.js" ; /**
 * Similar to  count , a reducer which ignores incoming values and instead
 * only counts them, finally yielding a value normalized to given `norm` (i.e. a
 * percentage).
 *
 *  remarks Also see  normFrequencies which uses this reducer to create a
 * normalized histogram.
 *
 *  example param norm export function normCount ( norm ) ; export function normCount ( norm , xs ) ; export function normCount ( ... args ) { const res = $$reduce ( normCount , args ) ; if ( res !== undefined ) { return res ; } const norm = args [ 0 ] ; return [ ( ) => 0 , ( acc ) => acc / norm , ( acc ) => acc + 1 ] ; }