You certainly can, but I'm not sure why you would want to.The purpose of a voltage regulator like the LM317 is to bring an unregulated (varying) voltage to a specific value. The LM317 is an adjustable regulator, so it will regulate an input voltage of up to 40V down to a stable output of anything from 1.25V up to about 37V. Regulators have a specified Input-Output voltage differential, in the case of the LM317 this is about 3V. So if you are using one to regulate a supply to 6v, you need to make sure that the input is 6+3= 9v minimum. If the input voltage falls below 9v, the LM317 output voltage may fall below 6v, and usually that's not what you want.Sop if your supply is a pulsating DC, eg the rectified output of a transformer, you would usually use smoothing capacitors to make sure that the input voltage is kept reasonably high so that the output would be stable.Now you can wire the LM317 to act as a constant current source (see the datasheet for how to do this). So you might just use it as a current limiter in a battery charger, for example. Batteries don't much care whether their charge current is pulsing or steady, as long as it is not excessive. So you could rectify your power transformer output, put it through an LM317 wired as a current limiter, and it would deliver pulses of a maximum of whatever current you have set it to.But for normal use, you would want to make sure that your input voltage is not pulsed. It may have ripple, that is it may have variations in it, as long as the value does not fall below your output voltage plus 3 volts.