Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: Precedence for Idiots

by Melly (Chaplain)
on Dec 01, 2006 at 16:10 UTC ( [id://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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-04-19 14:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found