Trying out a Scheme solution for this problem (), and it errored out on filter. My version of Gambit (Windows x64, 4.9.3) does not have filter.
Steve