The LM-317 Voltage regulator problem

Well, recently I have been attracted to laser diodes. I am trying to make them work. Here is what I learnt-

1. LASER diodes are pretty current hungry,it will eat as much as it gets,since it's internal resistance is pretty low.

2. To make LASER diodes work properly, you need a CONSTANT current source.

3.Red Laser diodes need 3 - 4 volt to run.

4.You can make a Laser driver using LM-317 (it's called DDL)

Now here comes the problem,I have used this circuit-

LM317_components01.jpg

But surprisingly the output gives the same voltage as the Input....I thought the IC was short,replaced it wit another one,but didn't work... I saw the datasheet of this LM-317. it was written there that The output voltage, i.e, the V0 is

vo=vref(1+ r2/r1); where r2 is the resistance between Vadjust pin and ground, and r1 is the resistance between Vadjust and Vout.

But on all the Laser Forums,the circuit above is shown. Now which is the correct alternative?

Here is another picture of the IC

LM317_basic.jpg