work with sets, filters and cycles

Im trying to represented a set of data with a mathematical expression but I don’t know what is the best method for this.

In programming you have data set like

var x = [1,2,3,4] 

and you can apply filter like:

x.filter( element => element > 2 ) 

or loops like:

x.foreach( element => { some filter conditions } ) 

exists a mathematical expression for this cases?

An apology if the question is very ambiguous, but I would like your guidance to begin to understand programming processes at a more abstract level and to be able to represent cases with clear and universal mathematical expressions that can later be translated into programming languages.