Iterating through a list and appending to a new list

I am trying to iterate through a declared variable list using conditional logic and then append to a new list so that it can be used as a filter later on. I tried to code in the logic I want to use in the code below but not sure if this is possible in Flux. Is there a way to do this in flux using something similar to the below or an alternative?

In the sample code I want the end result to have the variable list “selected_servers” contain a combination of servers from “chicago_servers” and “dallas_servers”.

location = ["chicago", "dallas"]
chicago_servers = ["server_1", "server_2", "server_3"]
atlanta_servers = ["server_4", "server_5", "server_6"]
dallas_servers = ["server_7", "server_8", "server_9"]

selected_servers = []
|> map(fn: (r) => ({
r with
    if r._location == "chicago" then [append chicago_servers to selected_servers]
    else if r._location == "atlanta" then [append atlanta_servers to selected_servers]
    else if r._location == "dallas" then [append dallas_servers to selected_servers]
    else [append ["Undefined"]]