import type { FnAny , FnO , FnO2 , FnO3 , FnO4 , FnO5 , FnO6 , FnO7 , FnO8 , } from "@thi.ng/api" ; import { illegalArgs } from "@thi.ng/errors/illegal-arguments" ; export function partial < A , T > ( fn , a ) ; export function partial < A , B , T > ( fn , a , b ) ; export function partial < A , B , C , T > ( fn , a , b , c ) ; export function partial < A , B , C , D , T > ( fn , a , b , c , d ) ; export function partial < A , B , C , D , E , T > ( fn , a , b , c , d , e ) ; export function partial < A , B , C , D , E , F , T > ( fn , a , b , c , d , e , f ) ; export function partial < A , B , C , D , E , F , G , T > ( fn , a , b , c , d , e , f , g ) ; export function partial < A , B , C , D , E , F , G , H , T > ( fn , a , b , c , d , e , f , g , h ) ; export function partial ( fn , ... args ) { let [ a , b , c , d , e , f , g , h ] = args ; switch ( args . length ) { case 1 : return ( ... xs ) => fn ( a , ... xs ) ; case 2 : return ( ... xs ) => fn ( a , b , ... xs ) ; case 3 : return ( ... xs ) => fn ( a , b , c , ... xs ) ; case 4 : return ( ... xs ) => fn ( a , b , c , d , ... xs ) ; case 5 : return ( ... xs ) => fn ( a , b , c , d , e , ... xs ) ; case 6 : return ( ... xs ) => fn ( a , b , c , d , e , f , ... xs ) ; case 7 : return ( ... xs ) => fn ( a , b , c , d , e , f , g , ... xs ) ; case 8 : return ( ... xs ) => fn ( a , b , c , d , e , f , g , h , ... xs ) ; default : illegalArgs ( ) ; } }