Follow Slashdot blog updates by subscribing to our blog RSS feed

 



Forgot your password?
typodupeerror
×

Comment Re:Perl is more expressive (Score 1) 192

Ok, in this thread there are already C++, Ruby, and Perl 6 versions of your snippets, so I'll add the Python ones.

@Lines = sort { $a->{Name} cmp $b->{Name} } @Lines;

lines.sort(lambda a, b: a.name < b.name)
or
lines.sort(key=lambda o: o.name)

@Files = <c:/Windows/*.exe>;

from glob import glob
files = glob("c:/Windows/*.exe")

I think a good analogy would be Perl is Finish, Python is Esperanto. When you have hundreds of thousands of LoC to maintain, I guess a more direct and unambiguous language is preferred.

It occurred to me that perhaps Perl is an attempt to seduce the computer... too bad it will take some time before it can appreciate language nuances... ;)

Comment Re:Almost all normal people realise (Score 1) 219

No, the OP does not have a point. Why are you focusing on one specific instance? Violence is widespread, and is committed by all kinds of people. Christians of all denominations in the US were quite content with the fact their government torture people (or offshore the task). The loads of innocent people that are killed in drone attacks are also not victims of muslim terrorists.

Religions are stupid and should be extinguished, but the correct way to achieve that goal is through education. With violence you'll only get more violence.

Comment Re:And so therefor it follows and I quote (Score 1) 353

Why didn't you just order a hamburger?

Because nobody offers that option. I would gladly request a refund for the Windows 7 that came with my notebook if I could. The only reason I keep its partition is because I paid for that crap, and just "in case I need it"... but it's been 3 years so far without booting it. I guess I'll just wipe it and give more space to my Linux partition whenever I get some time to do it.

Comment Re:bitcoin (Score 1) 241

Double spends for anyone who can connect to both sides of the network. Essentially, there will be two ledgers, an International ledger and a Russian one. If you spend on the Russian ledger, the International ledger will still have your money. When the network rejoins, whatever ledger has the most hashing power behind it will be chosen as the correct one, and all the transactions from the other one will be retried on the new global ledger. If the network saw a new transaction spending a previous transaction's outputs, it would be rejected, as well as any spends referencing that transaction, and so on.

Thank you, that's exactly what I wanted to know.

This happened already.

I guess I've missed the news, any links for my lazy ass?

Bitcoin sounds like a nice investment for dictators willing to further screw their populaces.

Comment Re:Still... (Score 1) 193

E.g., would you rather try to see which bit is set in a string like "0b001011010011011101011100" or have it broken up like "0b0010_1101_0011_0111_0101_1100" or "0b00101101_00110111_01011100". If it's a bit field, you may even want "0b001011_010011011_01_0_111_0_0" if breaking it into fields has meaning.

Such a small change to help readability...

If you're really interested in readability you would probably define those bits, like:

#define HIGHSTUFF (0b001011 << 17)
#define NOTSOHIGHSTUFF (0b010011011 << 8)

and then or them together.

Alternatively you could define a macro for your bit field, like:

#include
#define bitfield(a,b,c,d) 0x##a##b##c##d
int main() {
        printf("%x", bitfield(f,f,f,f));
}

Slashdot Top Deals

Today is a good day for information-gathering. Read someone else's mail file.

Working...