add a function with doctest