Index: Namespace.php
===================================================================
--- Namespace.php	(revision 4225)
+++ Namespace.php	(working copy)
@@ -255,6 +255,48 @@
 
 
     /**
+     * apply() - enables applying user-selected function, such as array_merge() to the namespace
+     * Caveat: ignores members expiring now.
+     *
+     * Example:
+     *   $namespace->apply('array_merge', array('tree' => 'apple', 'fruit' => 'peach'), array('flower' => 'rose'));
+     *   $namespace->apply('count');
+     *
+     * @param string $callback - callback function
+     * @param mixed  OPTIONAL arguments passed to the callback function
+     */
+    public function apply($callback)
+    {
+        $arg_list = func_get_args();
+        $arg_list[0] = $_SESSION[$this->_namespace];
+        return call_user_func_array($callback, $arg_list);
+    }
+
+
+    /**
+     * applySet() - enables applying user-selected function, and sets entire namespace to the result
+     * Result of $callback must be an array. Caveat: ignores members expiring now.
+     *
+     * Example:
+     *   $namespace->applySet('array_merge', array('tree' => 'apple', 'fruit' => 'peach'), array('flower' => 'rose'));
+     *
+     * @param string $callback - callback function
+     * @param mixed  OPTIONAL arguments passed to the callback function
+     */
+    public function applySet($callback)
+    {
+        $arg_list = func_get_args();
+        $arg_list[0] = $_SESSION[$this->_namespace];
+        $result = call_user_func_array($callback, $arg_list);
+        if (!is_array($result)) {
+            throw new Zend_Session_Exception("Result must be an array. Got: " . gettype($result));
+        }
+        $_SESSION[$this->_namespace] = $result;
+        return $result;
+    }
+
+
+    /**
      * __isset() - determine if a variable in this object's namespace is set
      *
      * @param string $name - programmatic name of a key, in a <key,value> pair in the current namespace

