|
|
Along with foot-in-mouth disease - they're a fowl bunch with all the crop they're involved in.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
but OTOH we are less prudish, there's tits everywhere!
Message Signature
(Click to edit ->)
|
|
|
|
|
When think of Woody do you think of a Woodpecker or something else?
I had my patience tested...I'm Negative!
|
|
|
|
|
Well, I'm quite fond of carpentry - have you got wood?
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
If you had to Picidae to post this then today was a good day for it. Hopefully it doesn't get a rise out of anyone here.
Socialism is the Axe Body Spray of political ideologies: It never does what it claims to do, but people too young to know better keep buying it anyway. (Glenn Reynolds)
|
|
|
|
|
|
|
Eric Lynch wrote: Rock on!
I was thinking something similar along those lines, but my inner ethic circuit triggered.
Latest Article - A Concise Overview of Threads
Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny
Artificial intelligence is the only remedy for natural stupidity. - CDP1802
|
|
|
|
|
It may just look like a big rock to you and I but it's a sure bet that there's a conspiracy theorist somewhere who has already found a dead Martian, a B17 or the Marie Celeste in one of those pictures.
Whenever you find yourself on the side of the majority, it is time to pause and reflect. - Mark Twain
|
|
|
|
|
I think I saw Elvis!
Latest Article - A Concise Overview of Threads
Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny
Artificial intelligence is the only remedy for natural stupidity. - CDP1802
|
|
|
|
|
Marc Clifton wrote: I think I saw Elvis!
You sure did! In fact there's at least 12 Elvis' there - all 100% real too.
Message Signature
(Click to edit ->)
|
|
|
|
|
Or the whole thing is fake and it's being done to get more money.
When you are dead, you won't even know that you are dead. It's a pain only felt by others.
Same thing when you are stupid.
modified 19-Nov-21 21:01pm.
|
|
|
|
|
Ok.. first step for Bruce Willis theory... check. One can land on an asteroid
Next try should bring a nuke... then we are all safe
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Sip slowly, NURSE
my girl MAID
you must look after the kids.
NURSEMAID
Nurse a drink[^]
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
To think about it, my logic was little back ward
sip slowly - nurse
Look after the kids - Maid
My girl - Nursemaid
cheers,
Super
------------------------------------------
Too much of good is bad,mix some evil in it
|
|
|
|
|
Doesn't matter, you got it!
I hadn't seen your post when I slammed the "Post message" button on the solution, I was in a hurry to help Herself fix lunch.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
int nThatVeryLongVariableYourMateNamed = 0;
if(nThatVeryLongVariableYourMateNamed != (0,1,2))
{
}
Instead of having to do like:
int nThatVeryLongVariableYourMateNamed = 0;
if(nThatVeryLongVariableYourMateNamed != 0 &&
nThatVeryLongVariableYourMateNamed != 1 &&
nThatVeryLongVariableYourMateNamed != 2
)
{
}
-VUNIC
|
|
|
|
|
You could do that as an extension method in C# pretty easily. The syntax would be something like
if (nThatVeryLongVariableYourMateNamed.Excludes(0,1,2))
This space for rent
|
|
|
|
|
Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy Falcon.
|
|
|
|
|
Not nearly as performant as the original. Though, if avoiding repetition is the OPs goal, a couple of other C# possibilities include:
int n = nThatVeryLongVariableYourMateNamed;
if (n == 0 || n == 1 || n == 2)
{
}
switch(nThatVeryLongVariableYourMateNamed)
{
case 0:
case 1
case 2
break;
}
private static readonly HashSet<int> validValues = new HashSet<int> { 0, 1, 2};
.
.
.
if (validValues.Contains(nThatVeryLongVariableYourMateNamed))
{
}
if (new int[] { 0, 1, 2}.Contains(nThatVeryLongVariableYourMateNamed))
{
}
In answer to the original question, I think there are some languages that support syntactic sugar for creating/checking sets. Though, none I commonly use. If I recall, in my hazy memory, I think the largely dead PASCAL language used to have such support
In general, it's not much of a problem. Almost all languages, have a decently concise syntax for creating/checking sets. They simply do away with the fluff of formalizing it as a separate concept in the language.
|
|
|
|
|
Yes - Delphi does:
Result: Integer;
...
if aPrompt and not (Result in [0, 1, 2, 4]) then
...
Not quite dead BTW - that's production code right there -> but its getting rarer these days.
G
|
|
|
|
|
Copy paste from SOverflow
static class Extensions
{
public static bool In<T>(this T item, params T[] items)
{
if (items == null)
throw new ArgumentNullException("items");
return items.Contains(item);
}
}
class Program
{
static void Main()
{
int myValue = 1;
if (myValue.In(1, 2, 3))
string ds = "Bob";
if (ds.In("andy", "joel", "matt"))
}
}
modified 20-Oct-19 21:02pm.
|
|
|
|
|
As Pete said, trivial to implement in C#:
public static class SomeExtensions
{
public static bool IsOneOf<T>(this T value, params T[] options)
{
if (options is null || options.Length == 0) return false;
return Array.IndexOf(options, value) != -1;
}
public static bool IsNotOneOf<T>(this T value, params T[] options)
{
if (options is null || options.Length == 0) return true;
return Array.IndexOf(options, value) == -1;
}
}
...
if (nThatVeryLongVariableYourMateNamed.IsNotOneOf(0, 1, 2))
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Now that's nice. I'm going to have to borrow that
"There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult." - C.A.R. Hoare
Home | LinkedIn | Google+ | Twitter
|
|
|
|