« first day (1621 days earlier)      last day (3320 days later) » 

5:00 PM
@thecoshman insofar as the existing one had to be supplied you'd get pushback
 
@Mgetz accepted
 
No it isn't
 
*it *= *it;
Is that understandable? (where it is an iterator)
 
Yes.
 
5:08 PM
No it isn't
 
Actually, I can make it a range for and turn it into just x *= x;
 
@R.MartinhoFernandes o_0 what is the '*=' doing? actually multiplying stuff?
 
What else?
 
@R.MartinhoFernandes A transform perhaps?
 
You guys are weird.
 
5:10 PM
@R.MartinhoFernandes vOv stupid operator overload stuff
 
@LightnessRacesinOrbit so what would you fix?
 
@AndyProwl for(auto&& x : a) { x *= x; } seems a lot less ceremonial.
 
@Mgetz the broken things
 
transform would have more moving parts.
 
Its understandable.
 
5:11 PM
@R.MartinhoFernandes ceremonial what
 
You need the output iterator, which would be the same as the source.
 
@LightnessRacesinOrbit what in specific is broken?
 
Sounds more confusing.
 
Dunno, I tend to use a transform when I have to process each element in a collection
 
5:12 PM
 
And then lambda boilerplate.
 
so erm... Java Collections... Stockholm syndrome or are they actually nice enough to use?
 
@AndyProwl In-place?
 
5:12 PM
@R.MartinhoFernandes Why not?
 
@Jefffrey as C tends towards Zero, that becomes quite the ratio.
 
@AndyProwl Because you have to provide the output iterator. It just feels out of place.
 
@Borgleader tl;dr plz
 
@R.MartinhoFernandes You can wrap that part in a general-purpose helper
 
But I really don't like C++11 lambdas.
 
5:14 PM
At the calling site, all you would see would be something like transform(c, [] (auto x) { return x * x; })
 
@R.MartinhoFernandes How so?
 
@Jefffrey Too much boilerplate. And monomorphic.
 
or in_place_transform
@R.MartinhoFernandes Yeah that's true
 
@R.MartinhoFernandes really?
 
You mean the boilerplate of specifying the type?
 
5:15 PM
@R.MartinhoFernandes I know what monomorphic means... but in this context?
 
@R.MartinhoFernandes Oh, it's C++14 that introduced auto in lambda arguments?
 
Although I tend prefer named algorithms over raw loops. In this case the for loop would be quite straightforward, granted
 
@Jefffrey Yes.
 
I think lambdas are pretty good.
 
Compare [] (std::complex<double> x) { return x * x; } with join (*), for example.
:P
 
5:16 PM
We have a Bartek here :P
 
They do have unnecessary syntactic noise, and up to C++11, non-polymorphic limitation
 
(I'm converting Haskell code and everything basically explodes a thousandfold)
 
std::multiplies<>
 
@Rapptz That takes two arguments.
 
@R.MartinhoFernandes obfuscated code does that :P
 
5:17 PM
@thecoshman no
 
oh yeah
 
I remember someone using lambdas for "regular functions" too. I don't remember who though. Maybe Rapptz.
 
You can still define your own squares functor
transform(c, squares<>{})
 
I have a pow2 function because I use it a lot
 
Doesn't look bad
Actually <> is not even needed
 
user1804599
5:18 PM
<> is nice.
 
And I guess not even {} if you do it the Niebler way
 
@AndyProwl Yeah, but then I'll never finish. I didn't realise how much was packed into these twelve lines I'm converting until I got to the thirtieth line of C++ and wasn't even one tenth of the way there.
 
For inequality maybe
 
functors sound cooler than lambed ass
 
Functors have the advantage of having names
 
5:18 PM
@R.MartinhoFernandes vOv I blame you :P
 
But then again lambdas can have names too
 
@AndyProwl 'cool names'
 
It's just that if you happen to define the same lambda more than once, you may as well define a functor and reuse that
 
@AndyProwl but that upsets people who get hung up on them being anonymous
 
@AndyProwl Well... I think that if we want to be pedantic, it's not lambdas that have names.
It's the binded variable that does.
 
5:20 PM
@Jefffrey OK, well, you know what I mean
 
I'm sorry.
 
user1804599
Are const members bad if you never assign to the things they are the members of?
 
@Jefffrey can we get pedantic and say that's not even a true name, just a human readable label?
 
Don't make const members.
 
@райтфолд They prevent value semantics
Or rather
Hinder
 
user1804599
5:20 PM
I don't need value semantics.
 
@thecoshman I'm pretty sure the standard says "name" or maybe "identifier".
 
@райтфолд yes you do, everyone does :D
 
@райтфолд Why bother, though? It's opt-out.
 
@Jefffrey the standard can suck my left one!
 
lol
 
5:21 PM
@райтфолд There's a difference between "I don't need it" and "I need to not have it".
> I don't need more than one instance
 
@райтфолд Then I'd say it's OK, if you're asking me. But in general you'd better listen to Robot
 
user1804599
What are the exact problems with const members?
 
To me, if you don't need value semantics, then the const-by-default thing applies
 
I still don't understand value semantic.
 
I think I do, but somewhat intuitively, non-formally
There are a lot of nuances
 
5:23 PM
Actually maybe I do. I just realized.
 
Value semantics is when the value represented by objects matters (i.e. some abstraction of their state), rather than their identity/address in memory
"stuff that behaves like the integers" etc.
 
Is it the idea that you pass by value instead of by references or pointers in order to take advantage of move semantic?
 
It's related, but that's not the gist of it
 
Like std::vector<int> func(std::vector<int>) as opposed to void func(std::vector<int>&)
And you would call it with auto x = func(std::move(y)), or something
 
Oh shit, I'll need nested lambdas for this.
 
5:26 PM
The gist of it is that your program cares about values, not about objects (probably inaccurate)
 
user1804599
The objects are also non-copyable and immovable.
 
Or I'll need to actually understand the code instead of just translating it mechanically.
I don't want to understand this code.
 
My rule of thumb is that if you can replace your T const & with T and your program still remains correct (possibly just less efficient), then you're using T with value semantics
If the program becomes incorrect, then you're using reference semantics
 
@AndyProwl You are not too convincing. Like what's the difference between object and value? An object contains a value.
 
@Jefffrey Yep, you just said it
An object is a region of storage
It has an address and it contains a few bits that represent a value
 
5:28 PM
Yeah, but I mean in the context of value semantic, I don't understand what's important with this distinction.
 
If your program only "cares about" values, you have value semantics
If your program also "cares about" addresses, you have reference semantics
 
I think I see.
 
ergh... what does this mean? find cache/atom-shell -name "debug\.log" -print0 | xargs -0 rm -rf
 
Consider a function foo(vector<int>& v) that modifies v
That function cares about the address of v
 
Argh. Converted two lines of the original. Twenty-five in C++. I'm tired already.
 
5:29 PM
Ok
@R.MartinhoFernandes Two lines of what original?
 
It needs to modify that object, not a copy of it. If you modify it to take by value, it will no longer work
 
OTOH a function foo(vector<int> const& v) that prints the contents of v does not actually care about the address of v for what concerns correctness. If you change it so that it takes by value, it remains correct
It will just have worse performance (probably)
That means it uses that type with value semantics
 
user1804599
It may care about the address.
 
user1804599
You can't tell without looking at the implementation.
 
5:31 PM
Well, if its job is to print the contents, it shouldn't care
 
Ok, I think I get it. But what's the point in C++?
You don't have value semantic most of the times.
 
As soon as I finish converting this I can get cracking on adding png generation support and then I can do a 1.0 release.
 
user1804599
Alright, time for documentation.
 
@Jefffrey You have it by default, in C++
 
Is it related to immutability somehow?
 
5:33 PM
Types get a default copy constructor and copy assignment operator, for instance
It is related to immutability but not the same thing
 
user1804599
No, but value semantics make mutability easier to work with.
 
@райтфолд How so?
 
Value semantics in C++ are really important to ensure lifetimes.
 
user1804599
@Jefffrey The fewer aliases, the easier mutability is to work with.
 
user1804599
Clean is pure and has mutability. :3
 
5:35 PM
Do any of you have examples of value semantic code as opposed to... non-value semantic code?
 
user1804599
@Jefffrey wait
 
6 hours ago, by Lightness Races in Orbit
anyone else get an email about static analysis?
 
@Jefffrey I gave an example above, with vector and stuff
 
user1804599
std::vector<int> x;
void f(std::vector<int> x) { }
f(x); // takes by value; new object constructed

std::vector<int> x;
void f(std::vector<int> const& x) { }
f(x); // takes by reference; alias of original object used
 
@LightnessRacesinOrbit people_affected++
 
5:37 PM
@AndyProwl damage *= damage
 
@AndyProwl That was the example I gave no?
 
@Borgleader Bless :(
 
@Jefffrey Pretty much, although you can't tell whether your type is used with value semantics or not just by the fact that a parameter is taken by reference rather than by value
 
// Uses vector with value semantics, but takes by reference for optimization
void print_all(vector<int> const& v)
{
    for (auto i : v) { std::cout << i; }
}
 
5:40 PM
@LightnessRacesinOrbit I'm so sad now :(
 
user1804599
With referential transparency, the difference is insignificant!
 
@Borgleader me too RIP
@AndyProwl wtf is that
std::cout << v lol
 
@AndyProwl I see.
 
That is going to be one big number.
 
I'll read about it.
 
5:42 PM
@LightnessRacesinOrbit C++ Lightness Compiler 2015 has cool diagnostics
 
Argh, now I need binary transform, but without any output.
Well, again with a summing output iterator, I guess.
 
error 2135, main.cpp line 4: wtf is that? lol
                                          std::cout << v
                                          ^^^^^^^^^^^^^^
 
Guess I'll write it after all.
Or a binary accumulate. Which shouldn't need to exist if there was a zip and if that zip composed.
 
@AndyProwl I can hear you talking here :)
 
@Jefffrey I was just about to suggest that blog post
Also, John Lakos has a few talks about it online
If you are not allergic to John Lakos I suggest watching them
 
5:46 PM
Fuck it, I'll just use a temporary vector. Screw performance.
 
@ParkYoung-Bae Also Hobbyte is 8 Hobbits.
 
@AndyProwl :P
@AndyProwl :D
@R.MartinhoFernandes The only meaningful temporary thing there is your respite from pain.
 
@AndyProwl Why would I be allergic to him?
 
@Jefffrey He's quite arrogant, full of himself, constantly talking about his achievements, etc. But his materials are good.
At least that's my impression from the talks I've seen and the interviews I've read
On my "I like/I don't like" scale he sits near the opposite end of the one Howard Hinnant sits on
or Bartosz Milewski
Scott Meyers, too
 
@Random832: SO is not a zero-sum game; there is not a finite quantity of reputation being moved around the system: it is generated and annihilated on demand. You accidentally answered your own question by observing that it is a deleted users' votes that are undone, not the resulting change in reputation of the votant (although that is usually an inevitable indirect effect). — Lightness Races in Orbit 1 min ago
"votant"
like it?
 
5:56 PM
K, heading home early today.
 
Xeo
> 7pm
> early
riiiight
 
It's 2pm where Robot is.
 
I left at 11pm yesterday. Give me some slack.
Also, I got to work at 2pm.
 
it's 2 PM here
 
6:07 PM
@R.MartinhoFernandes Are you working in games?
Because if not, then there are no excuses for leaving that late.
(unless you're a sysadmin)
 
Xeo
@EtiennedeMartel There are never any excuses for leaving that late!
 
He has mentioned multiple times that he only works 40 hours a week.
 
I see you're not familiar with Ubisoft.
 
Xeo
20 hours ago, by R. Martinho Fernandes
Protip: don't accidentally become the sysadmin.
 
@Xeo Wellllll, that explains it.
 
6:08 PM
So if he leaves late he makes up for it by leaving early another day.
 
user1804599
I love purple.
 
@Rapptz No it's not
 
@LightnessRacesinOrbit You don't live here.
 
@Xeo I routinely work past 7pm.
@Rapptz So? Doesn't mean I can't do basic maths.
 
@Rapptz So you're on the east coast then.
 
6:09 PM
Yep.
 
@Rapptz Or are you claiming that only Americans can count?
 
That means we're closer than I thought.
Yessssssssssss
@LightnessRacesinOrbit UTC-5 best time offset.
 
@EtiennedeMartel UTC-5.13 apparently
 
(UTC-4 as well, sometimes)
(Depends on whether or not you have daylight saving on)
 
Apparently the UK folk require minute precision when talking about time.
 
6:15 PM
shrug
You lied. I called you out on it. Get over it.
 
Nah, only the English. The rest of the UK is fine.
 
"lied"
 
America best continent
 
Can't even drive across it. Worst continent.
 
6:20 PM
America mostly incontinent
 
@R.MartinhoFernandes Sure you can.
 
@R.MartinhoFernandes You can drive through anything if you believe.
 
I think you can go anywhere in North America by car.
 
@Xeo day one: "how I turn my computer on?"
 
6:21 PM
@Rapptz The middle of any lake.
@Rapptz The top of the Rockies.
 
Can't go from North America to South America by car.
 
@Rapptz Somewhere with intelligent people.
 
@R.MartinhoFernandes Yeah I figured that's what you meant.
 
@R.MartinhoFernandes You can't?
I take it you're not allowing ferries
 
I take it you're not allowing cars that can fly
 
6:23 PM
The Pan-American Highway (French: Route / Autoroute Panaméricaine / Transaméricaine, Portuguese: Rodovia / Auto-estrada Pan-americana, Spanish: Autopista / Carretera / Ruta Panamericana) is a network of roads measuring about 48,000 kilometres (30,000 mi) in total length, except for a rainforest break of approximately 100 km (60 mi), called the Darién Gap. The road links almost all of the mainland nations of the Americas in a connected highway system. According to Guinness World Records, the Pan-American Highway is the world's longest "motorable road". However, because of the Darién Gap, it is not...
 
> except for a rainforest break of approximately 100 km
inb4 nitpicking
 
That must be an awesome road trip
 
"News" from where I live.
 
Xeo
@Rapptz what the
 
all white people are racist.
All of them.
 
user1804599
6:27 PM
I need to make "Mill" a backronym.
 
user1804599
Most impressive linguistic lust.
 
@райтфолд Mediocre Interactive Laxative Language.
 
Hey guys
 
what's a backronym?
 
@AndyProwl An acronym given an expansion only retroactively.
 
6:28 PM
ah
 
I wonder, what is the correct behaviour if the responses to a problem made you "circumvent the complete idea"?
 
Hi paul23.
 
My Incredibly Lame Language
 
@EtiennedeMartel you can make 'big news' if you are boringly pedantic
 
@paul23 On SO?
 
6:29 PM
Like, instead of using a tree structure you simply use a list/vector and ignore the linear search time
yes
 
@thecoshman The title is obviously click bait.
 
@paul23 Well, what about it
 
@EtiennedeMartel 5 reasons why that is click bait that and how this will save your life!
 
Well like I said: I asked for a solution to a problem.. But that solution was so complex and added so many layers of difficulty that I went to use the brute force solution.
 
Seriously, these days, a title has to be attention grabbing enough to stand on its own as a Facebook post.
 
6:30 PM
Facebook? [/care]
 
@paul23 Ok? So what is your question
 
No, I mean, what are you asking us?
 
Well what should I do?
accept the best written solution - even though I end up not using it.. Or write the actual solution I used myself?
 

Python

Room rules: sopython.com/chatroom Code formatting guide: tinyu...
 
6:33 PM
@paul23 Um, eat a burger? Bang a hooker? What do you want from me
 
....
 
@paul23 Both, I'd say.
damn, hungry now
 
@paul23 If you aren't satisfied with an answer, don't accept it.
 
Well it's not so much satisfaction as "oooh, this is more complexity than I wished for"
 
Accept an answer only if you think "yes, this solves the stated problem".
If you ended up changing the problem then that's an entirely separate thing, but if it's still somewhat related it may be worth writing it up in your own answer too.
Remember: you don't have to accept an answer.
If an answer best solves the stated problem but you're not going to use it, well the fact that you're not going to use it isn't particularly relevant. Accept it.
 
user1804599
6:37 PM
@paul23 Leave.
 
????
The welcoming, it's warming and touching!
 
I had a salade niçoise for lunch. It was pretty tasty.
 
Salad what?
 
@LightnessRacesinOrbit burger > hooker
fair point
 
Just don't bang the burger
 
6:41 PM
Tha'ts what donuts are fot
*for
 
Banging?
 
@райтфолд Don't be so fucking rude.
 
They have a hole..
 
@paul23 @райтфолд is the resident moron here. Just ignore him.
 
Nah just a way-too-late-joke
 
6:41 PM
@LightnessRacesinOrbit Leave!
Or I shall plonk you to death.
Leaves?
 
@LightnessRacesinOrbit He's just a child. He'll grow up eventually.
 
Been there, not done that!
 
@EtiennedeMartel I'm not so sure
@StackedCrooked ...
@ScottW there's a new Dacia Sandero?
 
I sounded cool.
 
user1804599
-1
A: How to see users in alphabetical order?

karel⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀

 
user1804599
6:44 PM
dat answer
 
-.-
preparing for project session tomorrow morning.
It's quite silly to have a project about data analysis - but you're literary the only one who knows the slightest bit of programming.
 
@райтфолд #squares
 
Last monday I was explaining what "objects" are, and why there are "dots" in names. But at the same time we have to do apply (and know) complex numerical ODE solving techniques.
I wonder if I should try to explain that I used RAII for file reading and lazy construction to speed up things...
 
@райтфолд He added his answer to another post via edit and then deleted his.
Weird..
> What does DP mean? (self.learnprogramming)
wot
 
@ScarletAmaranth It was more about making parallels than anything else.
 
6:53 PM
I could tell all the replies would be jokes about double penetration.
Oh. Dynamic Programming.
Who uses DP to mean that?
 
On a semi-related note, I wish [[noreturn]] void explodes(); int i = true ? 0 : explodes(); would work. I guess that makes for yet another Void only it’s half-heartedly in the type system?
 
How would that work?
 
I guess I want [[noreturn]] void to be Void :)
 
Use std::nullptr_t :v
 
true ? 1 : nullptr makes even less sense
 
6:57 PM
@paul23 i.e. you do all the job while some other lazy friend does nothing and passes the exam anyway
 
@Rapptz It’s a unit type.
 
Is value semantic a paradigm? Like programming using value semantic, is it a programming style?
 
Nope.
 
Xeo
@LucDanton It doesn't do that? Man.
 
@MarcoA. nah, we're working quite well together so far.. It's just that I spent 90% of my time explaining silly things instead of actually working at the problem.
 
Xeo
6:58 PM
Stupid attributes not being allowed to influence semantics
 
@LucDanton The original didn't make much sense to begin with!
 
@Xeo Attributes :/
 
@paul23 something like "what is a pointer"?
 
Xeo
@Rapptz Does int i = true ? 0 : throw boom(); make sense to you?
 
We've wisely chosen to use python :P
 
6:59 PM
@Rapptz [[noreturn]] void throw_some_stuff() { throw some_stuff {}; }
refactoring
 
@Xeo Yes.
 
The more I use that language the more I like it :P
 
Xeo
Then Luc's example should make sense too - explode is similar to throw in that case
 

« first day (1621 days earlier)      last day (3320 days later) »