Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Precedence for Idiots

by Melly (Hermit)
on Dec 01, 2006 at 16:10 UTC ( #587223=note: print w/ replies, xml ) Need Help??


in reply to Re: Precedence for Idiots
in thread Precedence for Idiots

Hmm... I half agree with you. A week ago, any code containing ?: would have confused the hell out of me, but purely because I'd never used it or made myself familiar with what it did (or, to be honest, even knew it existed).

However, I think one has to make a distinction between "this is obfuscated because I don't recognise the operator" and "this is obfuscated because I don't understand what the use of this familiar operator is going to produce under these conditions".

IMHO, once the basics of ?: are understood, then one could argue that one line of code to assign a value to a variable, rather than 6 is no more or less obfuscated, but may make the code more readable purely on the basis of being shorter... still, this might make an interesting discussion point in meditations, so I'll raise it there, and edit my tutorial accordingly according to the consensus...

map{$a=1-$_/10;map{$d=$a;$e=$b=$_/20-2;map{($d,$e)=(2*$d*$e+$a,$e**2 -$d**2+$b);$c=$d**2+$e**2>4?$d=8:_}1..50;print$c}0..59;print$/}0..20
Tom Melly, pm@tomandlu.co.uk


Comment on Re^2: Precedence for Idiots
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://587223]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2014-12-19 12:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (82 votes), past polls