partial implementation for scala list as function