How to define an anonymous function?