playing around with functional data structures in javascript