> 1) Is filter an effictient way for doing this ? I assume yes (optionally > using an inplace version filter!() may be advantageous).
If you need speed you may need to look into FastAnonymous to define your function. If this is not a bottleneck, then don't bother. > 2) It was surprising to me to see that "nobsTreshold" is visible to the > anonymous function in play1() and also to g() in function play2(). I > thought that in general function can see only its input parameters. Anyway, > it is extremely useful that e.g. in line g(x) = size(x, 1) > nobsTreshold; > g(x) sees nobsTreshold Functions are a nested scope and can see the variables in their outer scope(s). Have a read through the scope section of the manual.
