in reply to perl to protoype algorithms

Warning: rant about style ahead

$c=$w%24; if($c==0){$c=24;} $r=ceil($w/24); $n=(($c-1)*16)+$r;

Maybe if you used _words_ for variable names, more people would understand your code. I didn't even try to figure out what $c, $w, $r and $n are. This is for all programming, but for prototyping it is very, very important if you want to survive. Not everything is a 4-line script.

Whitespace also helps a lot:

$c=$w%24; $c = $w % 24; if($c==0){$c=24;} $c ||= 24; $r=ceil($w/24); $r = ceil($w / 24); $n=(($c-1)*16)+$r; $n = (($c - 1) * 16) + $r;
The second example is easier to read, imho. Note that I used ||=.

- Yes, I reinvent wheels.
- Spam: Visit eurotraQ.

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.