How to get length of specific ray type and use that as color?
Wow, I'm happy you thought of doing this.  Baking AO using Cycles is problematic since none of the available scripts bake properly.  

I still have not thought of a way to use the Ray Length node to adjust the results of the Reflection Ray but this basic setup looks good enough to suit my needs.

On the left is the Reflection Node used to control two shaders(or use 2 colors for 1 shader).  On the right is a default Diffuse shader.

Beautiful, thanks!



EDIT:  Here is a modified setup that may or may not be attenuating based on ray length.(I'm not totally sure that the setup isn't just behaving like a Color Ramp and squashing brightness/brightness)

The colors values for the Diffuse node and the Sky are all (1.0, 1.0, 1.0). 







UPDATE: using direct lighting should give the darkest effect without any color mix node setup.  Otherwise, what was done here cancels global illumination bounces to exaggerate the AO which is normally washed out from bounced lighting.