« first day (2175 days earlier)      last day (2771 days later) » 

Ven
1:00 PM
WTF are you doing
List.iter's first argument is a lambda
 
I don't KNOW what I'm fucking doing, that's the fucking problem.
 
Ven
you're passing print's result
TheLambdalessDerpstorm
List.iter takes a function. You know how to write a lambda/anonymous function in Ocaml.
 
List.iter ( fun ( x, y ) -> print_string x; print_int y ) listcounts;;
There.
Except it doesn't work
 
Ven
@ThePhD works better?
 
because listcounts isn't actually a list.
 
Ven
1:03 PM
What's the type of listcounts?
 
StringMap.bindings
 
Ven
Why are you calling List.iter on it then!?!?!?
 
what
 
Ven
when there's a val iter : (key -> 'a -> unit) -> 'a t -> unit in Map.
 
why are you calling List.iter on a function
 
Ven
1:04 PM
@Griwes what
@Griwes you have your argument order wrong
 
@Ven StringMap.bindings is a function
 
Awh fuck now there's no spaces or newlines.
 
StringMap.bindings foo is a list. :P
 
Ven
@Griwes ah yeah
Misread, my bad!
 
well it's also a function, just a nullary one returning a list which is fine. :P
 
Ven
1:05 PM
@ThePhD SSCCE.org
 
let counts = StringMap.bindings (count_words ["bark";"bark";"woof";"bark";"woof";"pant"])

List.iter ( fun ( x, y ) ->
	print_string x; print_string " "; print_int y; print_string "\n"
) counts;;
There we go.
 
That looks... fugly.
Why is counts a list even? Just save it as a map.
 
I'm gonna try to sort it once this thing works (which it doesn't).
 
Especially since there's iter in Map how @Ven noticed. :D
 
FFGFFFUck
WHERE DO I PUT THE PARENS TO MAKE IT PROPERLY ORDER MY ARGUMENT CALLS
 
1:08 PM
what
The order of evaluation of things shouldn't matter (maybe except for those prints).
 
StringMap.bindings count_words { STUFF } is complaining of too many arguments
 
Erm. Of course it is?
You have it properly parenthesized in the thing you pasted.
 
That doesn't work. :v
 
"Doesn't work" is unhlepful.
 
Oh, it doesn't work because I need ;; at the end.
Thanks OCaml.
 
1:09 PM
ah lol
 
Oh look my code is WRONG WHAT A SURPRISE qqqqqq
 
so basically this is exactly the same as C++'s missing semicolons.
 
Only you're accustomed with C++'s errors on that. :P
 
Sob. SOB.
1 1 1 1 1 1 1 1 1 1 1 1
My update_count is probably wrong.
So much for being correct by construction. q_q
let update_count key map =
	try StringMap.add key (StringMap.find key map) map with
		| Not_found -> StringMap.add key 1 map;;
That's semantically valid, but I wonder if it does the right thing.
 
1:12 PM
Erm.
It never increases the value.
 
... Oh.
 
lol
try StringMap.add key ((StringMap.find key map) + 1) map with
 
And we're good.
Now I am gonna try to sort it.
 
Also please just fold on that ;_;
 
What?
 
1:14 PM
I bet List has fold.
 
Ven
...you couldve just used Map.iter...
 
It does. Why?
@Ven I'm going to sort this list in a second.
 
@ThePhD It'd do your count_words in a sensible way.
 
Ven
stale backlog
 
Apparently there are proposals to add C++ attributes to C2x.
 
Ven
1:15 PM
uh?
 
@Griwes It... would?
 
let count_words words = List.fold update_count words StringMap.empty;;
Something like this. (@Ven please sanity check this)
wait
that's not sane
 
Ven
it is
 
Now it is.
 
Ven
That sounds pretty good. @ThePhD List.fold is what your manual accumulate does.
 
1:17 PM
@Ven It wasn't, the lambda was doing nothing since update_count had the right signature by accident. :P
 
Ven
I'm really baffled ocaml's Map doesn't have a "try_get" one
@Griwes yeah, but eta-{expansion,reduction} don't change a program's sanity. it still works :P
 
It works, but it wasn't sane code. :P
@ThePhD are you now starting to see the beauty of higher-order functions? :D
 
Ven
fair enough
 
@Griwes No, this would have taken me 8 lines of code and 5 minutes in C++. :l
 
@ThePhD And that's 7 lines too many.
 
1:20 PM
@ThePhD eh
Do you mean just the fold?
Or the entire thing?
 
The entire thing, sorting included.
 
Ven
let try_get key map = try Some (StringMap.find key map) with
  | Not_found -> None;;
let update_count key map = StringMap.add key 1 + (Option.default 0 (try_get key map));;
let count_words words = List.fold update_count words StringMap.empty;;
let counted = count_words ["a";"b";"c"];;
That's pretty much how I'd write your code
 
Writing update_count is Ffff.
 
@Ven nice
 
... M-Maybe I don't WANNA use List.fold.
FIGHT ME.
 
1:22 PM
@Ven missing key in the StringMap.add call.
@ThePhD That's stupid.
 
Grumble.
 
Ven
@Griwes thanks =)
 
:P
 
Ven
I'd be much nicer in Haskell since it doesn't retardedly use exceptions when an Option/Maybe is nicer
 
Xeo
@Ven missing map for StringMap.add ?
 
Ven
1:23 PM
@Xeo LEAVE ME ALONE OK
blame @Griwes for proof-reading poorly :D.
 
lol
 
@thecoshman you tell me
 
@R.MartinhoFernandes i rather thought you were addressing my narrow-minded attitude :) but yeah one is alive while they're learning
 
2 hours ago, by Ven
reminder: map is accumulate's first argument. you forgot about it here
 
@ThePhD you seem to assume we care about your silly prejudices.
oh no I can't write C++ in this language oh no my terrible life
get a grip
 
1:27 PM
@R.MartinhoFernandes we are bad at remembering arguments to function calls mmkay
 
Who's iksemy... again?
 
@BartekBanachewicz I'm a prophet.
 
Ven
@BartekBanachewicz I don't think there's any reason to get on any high horse
 
I knew you'd write exactly that bullshit once you appeared now.
 
@Griwes you didn't say that so it doesn't count
 
Ven
1:28 PM
When life's being a bitch, pat its head and tell it to fetch a stick.
 
@Ven no fold1?
that's a 1, not l BTW
 
Ven
@BartekBanachewicz how do you pass StringMap?
you forget about ocaml modules
 
am I about to discover something scary
 
not really no
 
Ven
a bit yes
 
1:29 PM
just a terrible name for a saneish thing
 
7 mins ago, by Griwes
@ThePhD That's stupid.
@Shoe some newcomer
 
your high horse wouldn't even notice the one I was riding on
 
1 hour ago, by ThePhD
It would have helped if anyone explained what currying was and where it was used in OCaml (e.g., apparently fucking everywhere).
oh man
 
@BartekBanachewicz Why is he arguing with robot
 
oh man oh man
 
1:31 PM
also yours would collapse due to its own gravity
 
@Shoe because he thinks loops are better than recursion
I'll let that sink in
 
OTOH Bartek (probably) thinks that recursion is better than loops
 
@Griwes Saying something is stupid is not similar to saying we are above caring about you being stupid. No high horse there.
 
@Griwes recursion is confusing
@R.MartinhoFernandes about "your silly prejudices", not "you being stupid".
 
@R.MartinhoFernandes Oh come on, don't correct me when I admit to slight high horsing. :P
 
Ven
1:32 PM
@Griwes I think both recursion and loops are the same thing
next
 
@Ven that was my point yes thank you
 
Which negative quality you attribute to the listener doesn't matter much, does it?
@Shoe I think we were more agreeing than arguing. Some ranting and some level-headed conclusions.
 
@Ven break out of it! you can’t continue like that
 
Ven
@LucDanton It's the last time I'm doing it – no redo.
 
@Ven No @Rerido
 
1:34 PM
it's rerito
 
@R.MartinhoFernandes Right. I thought it was the guy you were arguing with on SO.meta
That would have been fun
 
@R.MartinhoFernandes frankly I'd say that it's more stubborn than stupid
 
@Shoe It's been fun so far.
 
it's not that @ThePhD is failing to understand or learn, he isn't even trying
 
I eagerly wait his reply to the screenshot.
 
1:35 PM
:D
 
@R.MartinhoFernandes linky
 
Xeo
@R.MartinhoFernandes I wonder if there will be one
 
@R.MartinhoFernandes I kind of expect to never hear from him again, because of dropping that account and making a new one to avoid having to admit to being wrong.
 
To be honest, I never actually lied.
I just used a really shitty compiler (but one that is standard-compliant for the code in question).
 
1:38 PM
Oh wow, it seems thta Xorg crashed on my home machine for some reason o.O And coincidentally one of my tmux windows stopped responding over ssh...
 
@R.MartinhoFernandes what the
 
@R.MartinhoFernandes Well I think that technically it should do at least the first few phases of translation. :D
Like... preprocessing. :P
 
@Griwes It's alias hellcc=true
In C++: int main(){}
 
@R.MartinhoFernandes I know, but I'm not sure if that's technically legal for programs that should get at least through preprocessing. I mean the end result is valid, but I'm not sure about the process.
 
@Griwes Isn't that indistinguishable?
 
1:41 PM
I also don't think the answer should be deleted btw /cc @JerryCoffin
 
@R.MartinhoFernandes IDK
 
I mean, bar ill-formed programs.
I freely admit my hellcc fails at that.
And at basically any program that doesn't exhibit UB.
 
@BartekBanachewicz Fair enough. Vote to undelete it.
 
@R.MartinhoFernandes ...so... like... int main(){}? :P
 
@Griwes Right. So it cannot compile itself.
 
1:42 PM
I think deletes should be reserved for things like spam, obscenities, and outright vandalism
 
:D
 
being wrong, no matter how wrong, should just earn you downvotes
 
Ven
what a shitty behavior
 
@R.MartinhoFernandes meh, next thing all those people do is "but all common compilers do it that way"
IOW "both I know"
hmm I think I'll go to sign up for the exam today
better not waste time and weather
 
@BartekBanachewicz The best part is that there's an example of it clearly not working under MSVC in the comments under the question.
From yesterday.
 
1:47 PM
idgi what you can make from it other than exceptional ignorance of that guy
I stopped assuming he's gonna respond to reason after about 10 of his posts
using reason well after it completely failed is... unreasonable :)
> There is almost definitely going to be an OpenGL 4.6 or maybe even at some point OpenGL 5.0.
oh hey
 
Oh, more badware before even more badware.
 
@Griwes dunno, I saw some voices asking for deprecation of non-DSA functions in 4.6
this would actually be less badware
 
@BartekBanachewicz Can't. They agreed to admit wrongness if I could present an example.
 
@R.MartinhoFernandes I like how you assume he's not gonna weasel out of that
he's arguing on a different ruleset
you're bound by logic; he's not
 
@BartekBanachewicz He agreed to do so under mine, though.
 
1:53 PM
what prevents him from changing his mind?
I mean I get the idea of trying to eventually make him admit defeat
in a nice way, of course
 
Ven
lol arguing with people over the internet
you guys
 
but IME it takes a lot of time for people to admit they were wrong
want an example?
<-----
 
Ven
^
 
@BartekBanachewicz I just want him to realize what undefined behaviour means.
I'm doing that by framing the argument as "either you claim the compiler is buggy, or that the behaviour is not defined".
The only way to claim a bug is to refer to the specification.
 
@R.MartinhoFernandes TBH, I think that it's kinda overused in the C++ community
 
1:56 PM
@BartekBanachewicz In code or in discourse?
 
@R.MartinhoFernandes In discourse. There are certain kinds of UB that are "caught" by your compiler and are routinely used.
 
What.
Like what?
I mean, yes, OpenSSL is routinely used.
 
@R.MartinhoFernandes Please wait for Chandler's talk on UB to get uploaded, he kind of attempts what Bartek is doing right now.
 
@R.MartinhoFernandes I probably can't find any quickly enough, but I vaguely remember compiler docs being explicit about some things, disallowed by the standard, being described and allowed
In the end, if your compiler docs allow something, and you target specifically that compiler...
Well, maybe a bad example, but take Intel Cilk+
 
That's a language extension.
Terrible example.
 
1:59 PM
@R.MartinhoFernandes Can't a language extension make UB not-UB?
 
That's not the point though.
 
yeah was going to write that
You're technically ceasing to write portable C++ at that point, of course
 
indeed
some people do that with full consciousness though
 
oh good devil! I forgot just how many applications I had set for startup
log in and BOOM
 
2:01 PM
So if your point is that when you go beyond C++ the rules are not exactly C++'s, that's hard to argue against. It's sort of meaningless, though.
 
a splurge of application windows
 
@R.MartinhoFernandes Well some people will still argue that you're not "supposed" to do that simply because it's not C++ anymore.
Even further, they'll decline to analyze or look at your code because of that, while in reality it might still adhere to all other C++ rules.
 
@BartekBanachewicz What you're not supposed to do is to discuss it as if it were C++.
 
Oh that's for sure.
But maybe that's how it should be presented. "Your program works, but you're outside of what C++ defines."
 
@R.MartinhoFernandes is what that library does (well, tries to do) really that hard? seems to be riddled with so many flaws
 
2:03 PM
Now that doesn't necessarily mean "you can't do that" or "you're not supposed to do that". Awareness is key here.
 
@BartekBanachewicz Did you just define undefined behaviour?
 
@BartekBanachewicz Because when we say "That program has undefined behaviour", it means exactly that.
 
> You keep talking about "unconventional" like some kind of new-age healer. Your code is not unconventional. It is broken. Period.
but is it?
 
@BartekBanachewicz That particular code is broken.
 
2:05 PM
"Unbound value List.fold"
qq
 
@BartekBanachewicz Go browse CVE lists for uninitialized reads.
 
I dunno, I'm playing devil's advocate here of course.
 
This is what I get for trying to be fancy.
 
@ThePhD fold is a quite basic function, frankly. You know it under the name std::accumulate already.
 
Oh, it's called fold_left
Annnnd it doesn't work qq
 
2:07 PM
@ThePhD Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers.
@R.MartinhoFernandes it's just that lately I've been leaning more and more towards the "whatever works" PoV
 
@BartekBanachewicz I understand the point you're trying to make, but it's just completely inapplicable here.
 
You're probably right. I rest my case.
 
@BartekBanachewicz Uninitialized reads don't work. CVE databases are full of examples.
Mar 23 '13 at 14:43, by StackedCrooked
I remember reading about a program that used uninitialized variable as one of the sources of entropy for creating SSL keys. The optimizer decided that this made the sum of all entropy sources undefined as well, so it skipped the calculation.
 
:( I has this container object that is populated at some point, and I can't work out where it comes from. The earliest I can see it in this process, it's already been filled with incorrect data, and I can't find what happens before it. This project is so convoluted
 
I can't replace my accumulate with List.fold_left.
 
2:09 PM
@ThePhD why?
 
I think I'm doing something wrong.
The types of the arguments for fold_left aren't matching up.
 
it's typically (op, collection, start-value)
in whatever order
 
Maybe I'm missing the op bit...
 
@ThePhD what
 
@Griwes It's List.fold_left
Apparently
 
2:14 PM
Ah. Alright.
So just s/fold/fold_left/ in what Ven wrote after the fixes.
 
@ThePhD sometimes also called "accum"
think about the fact that sum can be done as fold_left with op and start partially applied as "+" and "0", respectively
monoids are great
 
Nnnnyeeeop doesn't work.
There's some type mismatch
in the op I'm using
 
post the error code?
 
post the code
 
Euugh but I don't wanna just leech answeers.
 
2:18 PM
@ThePhD are you changing the type of the accumulator respectively to the type of collection element?
 
Ideally find a coliru-ish thing for ocaml.
 
The accumulate I wrote is fiine. :<
 
@ThePhD Oh come on.
@ThePhD no it isn't
If I was your teacher and you turned something like that in, I'd fail it.
 
@ThePhD remember that full foldl is b -> (b -> a -> b) -> [a] => b, not all as
the order in (b -> a -> b) matters
 
@Griwes Wow, that's really harsh. ;;
Also @StackedCrooked mind putting OCaml on Coliru? :D
 
2:19 PM
@ThePhD If you are supposed to write OCaml, then write OCaml goddammit. It's the same as failing a C++ assignment written in what's virtually just C.
 
Ven
@ThePhD would you accept an assignment that calls .data() on a vector to find a manual .find looking through memory?
@ThePhD ideone has ocaml
 
@ThePhD Also see, you seem to be starting to like OCaml, that ;; is the evidence. :D
 
@ThePhD what's the type error?
 
val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b list -> 'a
 
2:21 PM
 
Okay, so list goes last, that's correct.
Your update_count seems wrong.
 
It takes the key, and the map?
 
Ven
you passed the map twice
instead of passing the map then the key
 
... Huh
StringMap.add returns the map if successful
 
Ven
use that damn ;; in count_words
 
2:24 PM
It's there, just after teh comment because I'm lazy. ;;
 
Ven
lol
you're right haha
 
It says I'm... not returning the right type?
Apparently it wants me to just return the key...?
But I need to return the map!
 
Ven
Swap the arguments to update_count.
fold_left is map -> key -> map
your update_count is key -> map -> map.
 
Oh.
 
That's what I said isn't it? :d
(But then I got confused by the unhlepful error message.)
ideone.com/bYuXDE there you go
lol suckage it doesn't highlight outside of the editor
 
2:27 PM
Okay, now I'm gonna sort this bad boy.
 
Ven
sigh
 
... What?
Annnd I can't sort to save my life. ;;
It compiles, though!
 
@BartekBanachewicz Yes. As posted, the code is ill formed, and won't even compile. At the very least, you need to add a cast before you can even start to argue about what it does being useful.
 
nwp
Latex made a nice table of contents for me. The subtopics get a nice true-type font, but the topics a pixelated bitmap font.... why?
 
@Ven does OCaml have Haskell's $?
@ThePhD Dunno, the first version of my attempt that compiled (...I hate the amount of parens, hence ^) worked. :P
@$
 
2:41 PM
"Syntax error" I don't like you either, OCaml. >:(
 
:D
you can always write this in Haskell
 
Ven
@Griwes you're cute
you think ocaml is a Nice Thing™.
(it's @@ because they like it ugly as fuck)
 
0
Q: msvc++ ignore undeclared identifier(С2039 )

rsdkIs there any way to ignore line, on which error "undeclared identifier" when compile?

/cc @Mysticial
 
no
no wowing
 
Ven
2:53 PM
you gw2 twat
 
no u
 
nwp
I wonder if the universe explodes when @R.MartinhoFernandes gets this badge.
 
Not just the universe
the answer to everything will increment
 

« first day (2175 days earlier)      last day (2771 days later) »