import type { Fn } from "@thi.ng/api" ; import { isIterable } from "@thi.ng/checks/is-iterable" ; import type { Reducer , Transducer } from "./api.js" ; import { compR } from "./compr.js" ; import { iterator1 } from "./iterator.js" ; example param fn export function map < A , B > ( fn ) ; export function map < A , B > ( fn , src ) ; export function map < A , B > ( fn , src ? ) { return isIterable ( src ) ? iterator1 ( map ( fn ) , src ) : ( rfn ) => { const r = rfn [ 2 ] ; return compR ( rfn , ( acc , x ) => r ( acc , fn ( x ) ) ) ; } ; }