Convert fn to totem and fix a bug

test_fn was not being run by the test runner
Two tests in test_fn were failing - flatten and interleave. For flatten, just the test was wrong. For interleave, both the test and the function were wrong.
I don't expect anything was using the broken version of interleave but we should probably check before merging this.