This one is similar to your first example.Junilu Lacar wrote:. . . compile a list of idioms that contrast imperative style code with functional style code. . . .
There are three kinds of actuaries: those who can count, and those who can't.
Stephan van Hulst wrote:I avoid char like the plague. Get used to working with code points (and IntStream) if you need to manipulate elements of a string. It will save you a lot of pain when you suddenly need to move away from western languages.
I'm going to be a "small government" candidate. I'll be the government. Just me. No one else.
Tim Holloway wrote:
Stephan van Hulst wrote:I avoid char like the plague. Get used to working with code points (and IntStream) if you need to manipulate elements of a string. It will save you a lot of pain when you suddenly need to move away from western languages.
![]()
Unless I am very mistaken, "char" is a Unicode character. Not the same thing as in C/C++ where "char" practically means thinly-disguised byte.
Tim Holloway wrote:Unless I am very mistaken, "char" is a Unicode character. Not the same thing as in C/C++ where "char" practically means thinly-disguised byte. So I fail to see where using char with non-western languages makes any difference.
In fact, the pædant in me says that treating characters as integers is the more questionable practice.
Paul Clapham wrote:Other planes (for which you need to distinguish code points from characters) cover such things as Linear B, Deseret, Manichaean, Pau Cin Hau, and a whole boatload of scripts which I'd never heard of. (Also Chess Symbols but that's a different thread.) So unless you're really into esoteric scripts you can get away with just considering a String to be a sequence of chars.
Stephan van Hulst wrote:Except that there are already a myriad of web applications that broke because they didn't take modern uses into account, such as emoticons. And using code points isn't that much more difficult than using chars in practice, because you can use character literals just fine.
Campbell Ritchie wrote:You can shorten that to
There are three kinds of actuaries: those who can count, and those who can't.
There are three kinds of actuaries: those who can count, and those who can't.
No, you can't; you have to trust Oracle that they did the work of creating Streams correctly.Piet Souris wrote:. . . Can you always easily see that parallelism always works?
No; you would calculate separate sums, maxima, minima etc., and combine them when the separate parallel Streams merge together.For instance, to take the average of a stream, can you split the stream into parts and somehow calculate the mean of the parts and combine these into the correct overall mean? . . . .
Campbell Ritchie wrote:
No, you can't; you have to trust Oracle that they did the work of creating Streams correctly.Piet Souris wrote:. . . Can you always easily see that parallelism always works?
No; you would calculate separate sums, maxima, minima etc., and combine them when the separate parallel Streams merge together.For instance, to take the average of a stream, can you split the stream into parts and somehow calculate the mean of the parts and combine these into the correct overall mean? . . . .
There are three kinds of actuaries: those who can count, and those who can't.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |