I'm developing on a OpenLayers application which creates dynamic rules for a vector layer using the [geostats][1] library. I want to create these rules inside a simple loop through the number of classes. I'm pushing every rule to a array and add this array via `stale.addRules()`. In my opinion every rule has to be cloned before adding it to the array. The problem is, I am using a `OpenLayers.Filter.Function` in which the `clone()` function is not implemented yet (OpenLayers 2.12-rc4).

How can I solve this?

At the moment, only the last rule gets visualized. It seems like the other rules get lost, due to the reference value issue...

My code looks like this:

    for (var i = 0; i < numClasses; i++) {
        filter_x = new OpenLayers.Filter.Function({
                evaluate: function(attributes) {
                    [...]
                }
            })
        var rule_x = new OpenLayers.Rule({
            filter: filter_x,
            symbolizer: { fillColor: colors[i],
                        fillOpacity: 0.5, strokeColor: "white"}
        });
        //var clone = filter_x.clone(); //returns null! clone is not implemented
        rules.push(rule_x)
    
    }
    style.addRules(rules);


  [1]: https://github.com/simogeo/geostats