Automatically assign the same name to gameojects part of an updated list

The list is updated depending on the proximity of my character. (from accepted answer)

Now what I want to do is assign the same name to every gameobject that come after the
first 4 gameobjects of my list, without having to do it manually everytime.

Think of something like this (list[4,5,6,7,…]).name = “wall_wait”;

import System.Collections.Generic;

function Update() {

        var array = GameObject.FindGameObjectsWithTag("walls"); 
        var list = List.<GameObject>(array);


        for (var gameObject in list)
            (list[0]).name = "wall_1";     
            (list[1]).name = "wall_2";
            (list[2]).name = "wall_3";
            (list[3]).name = "wall_4";
            (list[4]).name = "wall_wait";
            (list[5]).name = "wall_wait";
            (list[6]).name = "wall_wait";
            (list[7]).name = "wall_wait";
            //...and so on



function ByDistance(a : GameObject, b : GameObject) : int{
    var dstToA = Vector3.Distance(transform.position, a.transform.position);
    var dstToB = Vector3.Distance(transform.position, b.transform.position);
    return dstToA.CompareTo(dstToB);

I’m a C# person so this code might not be perfect but should give you the idea at least of how to do it.
You can itrerate over your collection by index, so you can set your first 4 manually, and then iterate from index 4 to the end of the list to set all names the same.

    for(var i=4 ; i < list.count ; i++)
        list*.name = "wall_wait";*