closure assignment

r programming assignment.