import type { Fn } from "@thi.ng/api" ; import { identity } from "@thi.ng/compose/identity" ; import type { Reducer } from "./api.js" ; import { groupByMap } from "./group-by-map.js" ; import { normCount } from "./norm-count.js" ; import { $$reduce } from "./reduce.js" ; /**
 * Similar to  frequencies , but with each bin value normalized to given
 * `norm`.
 *
 *  example param norm export function normFrequencies < A > ( norm ) ; export function normFrequencies < A > ( norm , xs ) ; export function normFrequencies < A , B > ( norm , key ) ; export function normFrequencies < A , B > ( norm , key , xs ) ; export function normFrequencies ( ... args ) { return ( $$reduce ( normFrequencies , args ) || groupByMap ( { key : args [ 1 ] || identity , group : normCount ( args [ 0 ] ) , } ) ) ; }