import { List } from '../types' ; import { curry2 } from '@typed/functions' ; import { length } from '../length' ; name export const append = curry2 ( __append ) ; export type Append = { < A > ( value , list ) : Array < A > ; < A > ( value ) : ( list : List < A > ) => Array < A > ; } ; function __append < A > ( value , list ) { const itemCount = length ( list ) ; const newList = Array ( itemCount + 1 ) ; for ( let i = 0 ; i < itemCount ; ++ i ) newList [ i ] = list [ i ] ; newList [ itemCount ] = value ; return newList ; }