Yep, or if you wanted to keep it all in one place you could do this:
Code:
<?php
function test() { ?>
<ul>
<?php list_categories(); ?>
</ul>
<?php }
add_action('wp_page_menu','test'); ?>
<?php wp_page_menu(); ?> Placing the function and add_action into your functions.php file makes the regular themes files easier to read, but doing the above way makes sure it's all in one spot. Personally I'd move it to the functions.php file, although I can see why leaving it the regular theme file itself may be less confusing since the menu code isn't split across two different files.