Add support for setting functions with operator[]
Add test cases for operator[]