import { List } from '../types' ; import { Reverse } from './types' ; import { length } from '../length' ; name export const reverse = function reverse < A > ( list ) : Array < A > { const itemCount = length ( list ) ; const reversedList = Array ( itemCount ) ; for ( let index = 0 ; index < itemCount ; ++ index ) reversedList [ index ] = list [ itemCount - 1 - index ] ; return reversedList ; } ;