curry and uncurry implementations with test