import type { L } from 'ts-toolbelt' ; import type { F } from 'ts-toolbelt' ; /**
 * An accumulable function can be passed its output as input
 */ type Accumulable < P , R > = ( arg0 : R , ... rest : P [ ] ) => R ; param f param again returns example function repeat < P extends L . Update < P , 0 , R > , R > ( f , again ) { return ( ... p ) => { const pClone = [ ... p ] ; while ( again ( ... pClone ) ) { pClone [ 0 ] = f ( ... pClone ) ; } return pClone [ 0 ] as R ; } ; } function times ( n ) { return ( ) => -- n > - 1 ; } export { repeat , times } ;