partial implementation of rank
rank function implemented in List