Re: The best "true zero" is...
by Anonymous Monk on Jun 08, 2005 at 21:05 UTC
|
| [reply] |
|
Absolutely!
--hsm
"Never try to teach a pig to sing...it wastes your time and it annoys the pig."
| [reply] |
Re: The best "true zero" is... ("winkie")
by tye (Sage) on Jun 08, 2005 at 04:27 UTC
|
Note that "exponential" is also called "winkie", due to The Wizard of Oz.
| [reply] |
Re: The best "true zero" is...
by marto (Cardinal) on Jun 08, 2005 at 09:08 UTC
|
The dog named Zero from "The Nightmare before Christmas" is the one true zero :P
Martin | [reply] |
|
The dog named Zero from the book _Ordinary Jack_ is the one true dog named Zero.
| [reply] |
|
Tha kamikaze who survives the mission is one true zero.
| [reply] |
|
Re: The best "true zero" is...
by ikegami (Patriarch) on Jun 08, 2005 at 15:55 UTC
|
Zero is nothing, so undef is the true zero!
(If only undef didn't give warnings in arithmetic...)
| [reply] [d/l] |
Re: The best "true zero" is...
by theorbtwo (Prior) on Jun 09, 2005 at 10:41 UTC
|
A lot of people don't seem to understand the poll... or I'm not getting their jokes, which is also possible.
Anyway, there is sometimes a wish for something that is considered zero when used in numeric context, but true when used in boolean context, that is something that will make the following print "42\n":
#!/usr/bin/perl
use warnings;
use strict;
my $x='<some choice on the poll>';
print $x+42, "\n" if ($x);
Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).
| [reply] [d/l] |
Re: The best "true zero" is...
by rinceWind (Monsignor) on Jun 08, 2005 at 10:34 UTC
|
Aha the naughty nought. I wonder how many others have been bitten by this with DBI return codes.
Are any of the other true zero values used I wonder?
--
Oh Lord, won’t you burn me a Knoppix CD ?
My friends all rate Windows, I must disagree.
Your powers of persuasion will set them all free,
So oh Lord, won’t you burn me a Knoppix CD ? (Missquoting Janis Joplin)
| [reply] |
Re: The best "true zero" is...
by BrowserUk (Patriarch) on Jun 08, 2005 at 13:27 UTC
|
print scalar reverse 'dogma';
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.
| [reply] [d/l] |
Re: The best "true zero" is...
by gwhite (Friar) on Jun 16, 2005 at 11:32 UTC
|
Number of times I have been right, according to my wife.
| [reply] |
|
'Wife'? Then she must admit you've been right at least once... ;)
| [reply] |
|
| [reply] |
Re: The best "true zero" is...
by NateTut (Deacon) on Jun 17, 2005 at 14:58 UTC
|
I think this is much ado about nothing.
P.S.
My favorite is the textual "zero" | [reply] |
|
There may be many ways to skin a cat, but only an escaped lunatic would actually try them out in practice.
(-S)
| [reply] |
Re: The best "true zero" is...
by grinder (Bishop) on Jun 09, 2005 at 08:22 UTC
|
Couldn't vote! The one true zero is just 0. No plusses, dashes, letters, spaces or any other superfluous fluff :)
update: yes, I am aware of the zero, true zero dichotomy which is what the poll is about. Let me just say... "truth wears many faces"
- another intruder with the mooring in the heart of the Perl
| [reply] |
|
| [reply] |
|
The one true zero is just 0. No plusses, dashes, letters, spaces or any other superfluous fluff.
Ah, but this poll isn't about the one true "zero" but about the best "true zero" — of the various values in Perl which are zero in numeric context but true in boolean context, which do you like best?
Just "0" fails cos it's false, not true; you need some of that "superfluous fluff" to make it a "true zero".
Smylers
| [reply] |
Re: The best "true zero" is...
by mce (Curate) on Jun 08, 2005 at 08:41 UTC
|
Isn't 0E0 and "Larry's 0 but true" the same? :-)
---------------------------
Dr. Mark Ceulemans
Senior Consultant
BMC, Belgium
| [reply] |
|
| [reply] |
|
use File::Temp; $th = File::Temp::tempfile(undef, "UNLINK", 1); $zbt =
+ sysseek $th, 0, 0; print $zbt, "\n";
The "E0" suffix appears with the
flip-flop operators, but "0E0" can never appear,
only "1E0", "2E0" etc.
| [reply] [d/l] [select] |
|
true, but also not true :-)
Many functions -like the execute function in DBI- return 0E0 when they want to return a result that is ment to be zero but is 'boolean' true in tests
So, indeed it is not general perl, but it is common to use 0E0 as "zero but true".
Cheers,
---------------------------
Dr. Mark Ceulemans
Senior Consultant
BMC, Belgium
| [reply] |
|
|
$ perl -wle'print "0 but true" eq "0E0" ?1:0'
0
They are both silently equal to zero yet true, but so are the other poll options (except "0x0").
$ perl -wle'print 0+"0 but true"'
0
$ perl -wle'print 0+"0E0"'
0
$ perl -wle'print "0 but true" ?"true":"false"'
true
$ perl -wle'print "0E0" ?"true":"false"'
true
| [reply] [d/l] [select] |
Re: The best "true zero" is...
by herveus (Prior) on Jun 08, 2005 at 12:41 UTC
|
| [reply] |
Re: The best "true zero" is...
by sekitan (Beadle) on Jun 08, 2005 at 19:27 UTC
|
how about our hero zero ( school house rock ) | [reply] |
Re: The best "true zero" is...
by rdm (Hermit) on Jun 09, 2005 at 01:33 UTC
|
| [reply] |
Re: The best "true zero" is...
by kutsu (Priest) on Jun 08, 2005 at 18:48 UTC
|
| [reply] |
Re: The best "true zero" is...
by jdhedden (Deacon) on Jun 09, 2005 at 13:32 UTC
|
I abstain from voting.
IMHO, the motivation for the poll is pathological. You're asking for the best obfuscation (yes, an oxymoron) for lazy programmers to use.
If you want zero to be true in a conditional, then the correct test is 'defined()'. | [reply] |
|
my $rows = $dbh->do(
'UPDATE MyTable SET note_date = GETDATE()
WHERE ErrorCode IS NOT NULL'
);
if ($rows) {
# true, even if zero rows were affected.
print 'Found and updated rows: (',$rows,")\n";
}
else {
warn 'Error during update query';
}
Having a query affect zero rows is perfectly valid, and doesn't necessarily mean an error. This makes even more sense when other methods in the same program return '0' as the false value rather than undef: it allows for programmer choice and a consistent read.
Larry Wall is Yoda: there is no try{}
The Code that can be seen is not the true Code
| [reply] [d/l] |
Re: The best "true zero" is...
by gloryhack (Deacon) on Jun 10, 2005 at 07:24 UTC
|
What does it mean? It means nothing. It is as it is and has no need for
meaning.
-- Edward Abbey, Desert Solitaire | [reply] |
Re: The best "true zero" is...
by pikus (Hermit) on Jun 14, 2005 at 13:56 UTC
|
Exponential makekes me think of Morris Day and the Time.
0E0E0! My Jungle Love!
- pikus
"I want to live 'till I die. No more. No less." - Eddie Izzard
| [reply] |
Re: The best "true zero" is...
by vksbalaji (Initiate) on Jun 09, 2005 at 09:49 UTC
|
Let Zero be the way it is why prefix or suffix it.....
| [reply] |
Re: The best "true zero" is...
by Paulster2 (Priest) on Jun 10, 2005 at 13:00 UTC
|
| [reply] |
|
| [reply] [d/l] |
|
| [reply] |
Re: The best "true zero" is...
by mattr (Curate) on Jun 14, 2005 at 07:59 UTC
|
I misplaced the data but believe it begins like dd if=/dev/zero of=/dev/hda | [reply] |
Re: The best "true zero" is...
by jonadab (Parson) on Jul 06, 2005 at 14:06 UTC
|
The thing I like about "0 but true" is that it is
self-explanatory; with any of the others, I'd feel
obligated to insert a comment explaining why I
was returning zero in that particular way, so that
some hapless soul a few years later doesn't pull
out hair figuring out why my code is so weird; with
"0 but true" I expect any decent Perl programmer
to be able to figure it out, because the jist of
the reason is contained in the value; assuming the
reader understands context, it'll just click. (And
if the reader doesn't understand context, he won't
be able to maintain my code anyway; I make frequent
use of context and consider it a major concept of
the language.)
| [reply] |
Re: The best "true zero" is...
by 2shortplanks (Initiate) on Jul 08, 2005 at 16:33 UTC
|
use Scalar::Util qw(dualvar);
my $true_zero = dualvar(0,"my true zero is better than yours");
Since that's a real zero. None of this string being parsed as zero stuff. | [reply] [d/l] |
Re: The best "true zero" is...
by Dove_From_Above (Initiate) on Jul 08, 2005 at 15:36 UTC
|
Surely the best definition of true zero is "Sigma (everything) == 0". Where everything includes all real, rational, irrational, transcendental and imaginary numbers, concepts, thought processes, definitions of zero, snippets of code, people, things, space, vacuums, natures abhoring vacuums, lumps of rock, B list movie stars etc etc etc. Otherwise you imply that existance actually has a starting point (and where did that starting point come from ... ) (and where did that starting point starting point come from ....) onto infinity ... rather than being either just there or illusionary or pre-determined. Personally I like Larry's ("0 but true") statement as a good description of existence. | [reply] |
Re: The best "true zero" is...
by ikegami (Patriarch) on Jul 28, 2010 at 16:31 UTC
|
$ perl -wle'print 0+"0x0"'
Argument "0x0" isn't numeric in addition (+) at -e line 1.
0
Behaviour change or bad poll option?
Update: 5.3 warned.
| [reply] [d/l] |
Re: The best "true zero" is...
by apotheon (Deacon) on Jul 01, 2005 at 02:07 UTC
|
The one true zero is
print substr("Just another Perl hacker", 0, -2); |
|
- apotheon
CopyWrite Chad Perrin |
| [reply] |
Re: The best "true zero" is...
by Anonymous Monk on Mar 02, 2009 at 06:00 UTC
|
to describe true zero utilizing computer binary code processed into the form of black font, is to defeat the purpose of materializing nothing. The though of zero is the manifestiotion of more than zero, therefor to ask people to represent zero is to ask them to edify a sum higher than the topic thereof. It is for this reason that zero was the lack of thought dwelling in the depths of conciosness before my brain processed your question posted in this thread, assuming that I was lost in the though of oblivion, in which case a sum greater than 0 consisted therein. This is all based on the theory that the mind is a product of geneticly stored data in cell memory, and the enviornment surrounding hosts while expanding creates their thought patterns. Nothing is nothing is somthing because you are processing it. | [reply] |