« first day (461 days earlier)      last day (4486 days later) » 

4:00 PM
Hello all! I have a problem with OPT algorithm ( pastie.org/private/nvlnvggxjubwftjxxvunw ), valgrind is giving me error at line #85 (Conditional jump or move depends on uninitialised value(s)). I guess it has something to do with "break", is there a way to fix it?
 
but I want to just do jom && jom test and have it work...
 
we aren't naughty, are we???
 
@TonyTheLion no, it's men who are 'camp' or act in the stereotypical gay way, but are in fact straight
 
@thecoshman right
 
@rubenvb welcome, to the real world
 
sbi
4:01 PM
@rubenvb Shrug. I told you.
 
I'm not saying I didn't know so.
 
@TonyTheLion could be a south park word, but I am sure I have heard it used outside of south park
 
ohhh south park :P
 
@Als for(s = i+1
 
Is "metrosexual" a Windows 8 feature? :) Tony @ http://chat.stackoverflow.com/transcript/message/2419235#2419235
full circle :P
 
4:02 PM
damn bonobo
 
Als
@RMartinhoFernandes I realized as soon as i Typed and hence deleted it.
oh damn seems it never got deleted :( fuck my internetz
 
oh internetz
 
Als
Its hard to notice the notification bar, it says "timeout"
 
sbi
@Als Yuck. Don't you have girls over there?
 
Gosh.
@sbi Or boys.
People in general.
 
4:06 PM
@RMartinhoFernandes things
 
Als
@sbi: hmm...
 
if it is a thing, you can do the naughty with it
just saying is all
 
Als
@RMartinhoFernandes huh? Boys? Peado...
 
sbi
4:06 PM
@RMartinhoFernandes Or goats, for all I care. But the Internet? I don't want his, erm, to creep through my Ethernet cables...
 
I assumed we where talking about sex again :(
 
yay passed test through ctest
yay for me
 
Als
Hmm... I am going to go have some din din.
I should try to be a better(read sober) man like @TonyTheLion
 
@Als probs for the best
 
sbi
4:08 PM
@Als Please do not have din din with our Internet. Please!
 
You guys are sick perverts.
 
Als
@RMartinhoFernandes That is one feature in abundance here :P
 
sbi
@RMartinhoFernandes And what are you? A healthy pervert?
 
Als
A robo-Pervert
bye guys, have asexual fun filled day :)
 
Really, goats? Things?
 
4:10 PM
@RMartinhoFernandes ¬_¬ and what does your robot misses make of you interfacing with all sorts of computers?
finely found a way to remember off v of. When I want to tell someone to FUCK OFF, I need to give it plenty of Fs
thus; get off the table; I've got the hang of this so get off my back.
I know English I do :D
I hope this works ¬_¬
 
sbi
@thecoshman Old farts like @Alf and me (and a few others) remember the Stones' Get Off of My Cloud.
 
@sbi was I right though with my usage of 'off' and 'of'
 
sbi
@thecoshman Yup.
 
YAY!!!
@thecoshman to twitter with you!
 
4:17 PM
struct inheritance is public by default, right? So I could drop the public from : public?
 
@rubenvb yes, but don't forget, if you use private or protected, before it will fuck you over
I personally think explicitly stating public can't hurt
 
ok
I'll leave it
having trouble with is_signed on a non-numerical class
dammit
 
@rubenvb what? how can a non-numerical class have a sign? or do you not mean +/-
 
@thecoshman I'm writing my own is_signed etc...
for academic purposes
and cleanliness.
 
Still, why do you want is_signed to work on non-numerical classes?
 
4:21 PM
@rubenvb but what does it mean for your class. If you had a 'sentence' class, it wouldn't really make sense to say it has a sign
 
it's trying to do a T(-1) < T(0), but that should only be used for numerical types
I don't want it to work.
How can I enable_if a struct type_trait thing for numerical types?
 
Xeo
The easiest is_signed is with specializations
There are only so-many signed types
 
@Xeo don't want that. Already have that for is_integral and is_floating_point
 
@rubenvb So you want it to return false?
 
so a combination of those two, plus the comparison of -1 and 0 should do the trick
 
4:22 PM
The standard one doesn't really care.
 
Xeo
Well, if you don't accept the easy solution, then suffer.
 
@Xeo lol
 
is_arithmetic<T>::value && T(-1) < T(0)
 
@RMartinhoFernandes doesn't it just return false?
oh, is is_arithmetic some kind of is_numerical?
 
Xeo
@RMartinhoFernandes && in TMP doesn't short-curcuit
 
4:23 PM
as in, is_numerical doesn't exist?
 
@Xeo I know. But that's how the standard does it.
 
Xeo
Really?
 
@rubenvb It's is_arithmetic.
 
Xeo
So we get an error if T is not constructible from a number?
 
ok
let's write that one
 
4:24 PM
@Xeo Yep. Table 49.
 
as is_integral && is_float
 
Xeo
@rubenvb ||
 
ah yeah, duh
how do I enable_if structs though?
 
Xeo
Huh?
What do you actually want to do?
 
Specializations!
 
Xeo
4:26 PM
I mean, you could do with partial spec, but..
 
yes, but not for evey type seperately
no partial spec... I have friggin typetraits for something ;)
 
well, it's been an action packed day for me; time to go home. Take care all! Let the counting begin
 
Xeo
template<bool Enable = std::is_same<X,Y>::value> struct Z{ ... };
template<> struct Z<false>;
 
Again, do you want a solution, or pain?
 
Xeo
There, enable_if'd
 
4:28 PM
ah yes, I see how Howard did it:

template <class _Tp, bool = is_integral<_Tp>::value>
struct ___is_signed : public integral_constant<bool, _Tp(-1) < _Tp(0)> {};
but then I'd need a helper template. Grrr
oh wait
I'll just use alias templates
I'm not exposing the raw structs anyways
win for me!
 
Can't specialize alias templates.
Not sure if I understand what you're doing, but I thought I should mention it.
 
@RMartinhoFernandes don't worry:
template<typename T>
constexpr bool is_arithmetic() { return is_integral<T>() || is_floating_point<T>; }
if that compiles
haven't checked yet
 
Of course you haven't checked.
 
lol
 
That's buggy.
That will return true for everything.
 
4:32 PM
why?
 
Because is_floating_point<T> converts to true.
 
yeah, I forgot ()
hmm, now to get is_signed to work.
ah yes, easy. is_arithmetic && __is_signed
I'm awesome
crap
I'll still need enable_if somewhere
 
Why? I don't think you need enable_if for any of the standard traits.
 
This ain't working:
template<typename T>
constexpr bool is_signed() { return is_arithmetic<T>() && __implementation::is_signed<T>::result; }
is is_signed uses the T(-1)<T(0) thing
on a non-arithmetic class
 
Xeo
Show the is_signed impl code
 
sbi
4:37 PM
 
@rubenvb Neither does the standard one.
 
Xeo
You're apparently doing it wrong
 
template<typename T> struct is_signed : public integral_constant<bool, T(-1) < T(0)> {};
@Xeo probably, it's called experimenting
 
Xeo
@rubenvb Fail, why not like Howard does?
 
with integral_constant being the same as the std one
@Xeo he uses more underscores
I though I could maybe do better <fail>
Maybe I can make an enable_if_bool
that would work, won't it?
 
Xeo
4:38 PM
template<typename T, bool = is_arithmetic<T>::value>
struct is_signed : public integral_constant<bool, T(-1) < T(0)> {};

template<class T>
struct is_signed<T,false> : public false_type{};
Like I said, just use a damn partial spec
 
lol ok. I didn't see that
 
Why do you even want this to work for non-numerical types?
Because now you're adding a third state into the mix.
 
doesn't std::is_unsigned<dummyclass> work without errors?
 
@rubenvb No!
 
ah ok. I'll drop the issue then
 
4:40 PM
If you do this, you can't ever test is_signed<T>::value and move on.
You have to test is_signed<T>::value && !is_unsigned<T>::value or something.
Because now you have signed/unsigned/something-else.
 
huh?
 
That's probably why the standard doesn't care about non-numerical types.
 
@RMartinhoFernandes that would be in the case of adding a non-numeric case only?
 
@rubenvb Exactly.
 
ok
no stress
everything's still fine in my messed up head
thanks
 
4:43 PM
I can understand that in some corner case, it might make sense for is_unsigned<std::vector<T>>::value to be false, but in order to get that, you're sacrificing the 99% use case.
 
if (isupper(c) && isalpha(c)) ... // just to be on the safe side!
 
Xeo
isalpha sounds stupid
 
@FredOverflow Where was that?
 
@RMartinhoFernandes some student's code, without the comment of course :)
if (isupper(hand) && isalpha(male)) ... // :-)
 
4:46 PM
My algebra teacher used to say that a null matrix was represented with an uppercase zero.
 
uh
wot?
 
@FredOverflow lol
 
Like this: uppercase zero with subscript size.
 
That's a huge zero indeed. It's so huge it's almost a one!
 
4:47 PM
This looks right, doesn't it?
except for the text in most asserts, which is just copied
 
@rubenvb What is that?
 
@RMartinhoFernandes There's nothing upper or lower case about that zero. It's just a zero.
 
I just realized that all function calls are kinda sad: f(a, b, c); Note the sad smiley face at the end of the line?
 
@DeadMG I know. But my teacher apparently didn't.
@FredOverflow Hey, I was thinking about that this morning.
 
@Pubby the beginnings of a new fail project by me. A standard library without the standard library
 
4:49 PM
@rubenvb Looks fine, but lacks testing with pointers and references and all that crap.
 
@RMartinhoFernandes ah, and const volatile stuff too
 
@RMartinhoFernandes Now we finally now why programming in Scala is so much more fun than programming in Java. You don't litter your code with sad smiley faces!
 
is std::is_integral<int&&> of the true type?
 
@rubenvb You mean make_unique<fail_project> since new is a big no no!
 
@rubenvb No.
 
4:51 PM
@rubenvb I would be surprised if it was.
 
@FredOverflow hmm, new is a keyword in the language. Jury is still out on that if I will allow it in whatever this will turn out to be.
 
Jury in the slaughterhouse
@rubenvb Wait, are you doing a library or a language?
 
@FredOverflow I'm attempting to do a library that can be used in C++, but does not include any C cruft if you include its headers.
 
Dammit, I already leaked 290 rep. I gotta stop helping people!
 
What do you mean, "leaked"?
 
4:53 PM
@rubenvb You can't kill new though.
@FredOverflow Past the repcap.
 
@RMartinhoFernandes indeed. It's acceptable. It's like std::initializer_list I found a way to define it and cooperate with the std headers
 
Isn't stack overflow all about helping people in need and spreading the knowledge?
I'm kidding of course, rep is everything!
 
@rubenvb Oh, all you need for that is to provide the ctor GCC is expecting :) It can be easily fooled into thinking it's his own.
 
4:55 PM
@RMartinhoFernandes yeah, a compatible declaration and the header include guards stuff
so you could in theory still include <initializer_list> if you really wanted to
but I would really prefer you to use my <types.hxx>
 
Do you support rune_t?
 
no! The locale stuff is going to be cool though
and a big ass load of work
I'll try to avoid <locale.h> and friends.
because those are 1) incomplete 2) untrustworthy 3) a mess
not to mention unstandardized locale naming
 
sbi
@Xeo: Plink!
 
a reference to a fundamental type is the same as a reference to any type for is_signed and friends, right?
 
4:59 PM
How do you hide the black window in C++?
 
Xeo
@sbi Da fuqq!
 
@rubenvb Right.
 
sbi
@Xeo Got mail.
 
@FredOverflow rep in VS??? I don't want to be writing my code everyday for rep
 
@FredOverflow That is ridiculous. Somehow awesome, but mostly ridiculous. I can't believe they actually released it. Wait...had to check the calendar to make sure it's not April 1st.
 
Xeo
5:03 PM
@FredOverflow lol'd
@sbi Thought so, thanks!
 
ok, why would anyone want to do web dev in Haskell?
 
Because monads.
 
@TonyTheLion Why not?
 
ah right, forgot about monads
 
And web model is surprisingly well-fitted to pure model. One request => one response.
 
5:06 PM
@RMartinhoFernandes because I don't get Haskell. :|
@CatPlusPlus never thought about it that way
 
Plus, HTML combinators make HTML actually not painful.
And cool.
 
It's awesome.
 
in Haskell, 2 days ago, by sbi
It finally just dawned on me how awesome Haskell is.
 
5:07 PM
@sbi was in the Haskell room??
maybe I need to buy a book on Haskell
and read it
see how awesome it really is
 
sbi
@TonyTheLion Just to drop @GMan's tweet.
 
LYHFGG is free.
 
@sbi oh right
 
Buy a book? There are like 3 free ones available
 
where?
 
sbi
@Pubby Yeah. Good C++ books are expensive, and Haskel books are free. Makes me wonder, you know.
 
Haskell is much simpler.
 
And you can get LYHFGG on paper if you don't like the Amazonian forest.
 
5:09 PM
@sbi C++ is just way more complex.
 
I said that!
 
sbi
@FredOverflow TANSTAAFL.
 
What?
 
there is if you're homeless
 
There Ain't No Such Thing As A Free Lunch.
 
5:10 PM
That's actually Googlable.
 
I bought learn you a haskell
 
haskell looks like a pool of all the most useful yet confusing syntax of every language moving into the 21 century. I could hope that it would be easier to intuitively understand, but if that would affect it's dynamic power, then far be it from me to stifle a good thing.
 
because I'm a good citizen
 
sbi
@RMartinhoFernandes I think it's usually Siberian or Canadian forest.
 
user142019
I was reading Learn You a Haskell an hour ago. :p
 
5:11 PM
not dynamic
 
@Xaade I don't think we're talking about the same Haskell here.
 
Confusing syntax?
 
As seen by who, Brainfuck programmer?
 
installing Haskell platform
 
5:12 PM
"All those letters, where do they come from."
 
The only thing that's wrong with Haskell's syntax is that they got : and :: mixed up ;) It's really confusing when you're doing both Haskell and Scala.
 
user142019
Trying to solve Project Euler problem 2 in Haskell. My code is slow as hell.
 
Don't do Scala, then.
 
@FredOverflow : is best cons operator. Trust me, I've tried every combination of symbols and : is by far the best.
 
| is pretty good.
 
@WTP Did you realize that the even-valued terms appear in a pattern?
 
user142019
@FredOverflow no.
 
Every third one is even.
 
user142019
and the other ones are odd?
 
5:15 PM
So you can simply compute the fibonacci numbers below the threshold, take every third, and then add them.
 
The sum of two odd numbers is even.
 
@WTP Yes, just look at them.
 
user142019
Thanks. 2nd attempt…
 
You guys are CHEATERS!!!
I'm telling.
 
What happened?
 
sbi
5:17 PM
@keithlayne In math, cheating is called "cleverness."
 
@sbi "if you're not cheating, you're doing it wrong"
...or, "you're not trying hard enough"
I thought Project Oiler was fun. It helped me get a lot better at python. Now I've forgotten most of what I learned.
 
@WTP btw, how slow are we talking about?
 
user142019
@RMartinhoFernandes It took more than a minute. Actually, I don't know if it would have ever ended if I didn't hit Ctrl+C.
 
Ow. And what are you trying now?
I doubt that simply taking every third number will help a lot.
 
fibs = scanl (+) 0 (1:fibs)
takeEveryThird (x:_:_:xs) = x : takeEveryThird xs
solution = sum $ takeWhile (<= 4000000) $ takeEveryThird fibs
 
5:25 PM
@FredOverflow That's similar to mine. But that's an efficient fibs.
 
@RMartinhoFernandes It's one of the standard examples that woo you into Haskell ;)
 
It runs pretty fast even if you test every element for evenness anyway.
 
right, shouldn't make such a big difference
 
So I guess @WTP is using a bad one.
Like a recursive function that computes only one number.
 
your mother would make a better recursive function
 
user142019
5:30 PM
"You are not permitted to submit another guess within 30 seconds of your previous submission" is the captcha not enough?
 
That's probably to prevent you from spamming answers until you get it correct.
 
Okay, I got it down to one line:
solution = sum $ takeWhile (<= 4000000) $ fix (\f (x:_:_:xs) -> x : f xs) $ fix (\xs -> 0 : scanl (+) 1 xs)
@RMartinhoFernandes You wanna make it pointfree? ;)
 
I got it in C++, IDEone runs it in 0.02s. Now how do I know if I'm right?
 
sing up, login, paste answer
 
user142019
Problem 20 is a piece of cake.
 
5:38 PM
Making \f (x:_:_:xs) -> x : f xs pointfree is apparently not so easy, lambdabot spits out lots of noise
 
I prefer codechef, I like making my code fast
@FredOverflow what language are you playing with?
 
Haskell
 
@FredOverflow Ow. foo = (`ap` tail) . (. head) . flip flip tail . (ap .) . flip flip head . (((.) . const) .) . flip flip tail . (ap .) . flip flip head . (((.) . const) .) . flip ((.) . (:)) (I didn't do it :)
 
user142019
I'm pretty new to Haskell but it's awesome.
 
@RMartinhoFernandes Haskell's sections confuse markdown :)
And yes, I also chatted with lambdabot recently :)
 
5:41 PM
@MooingDuck Ha! My three line Haskell solution runs in 700 ns.
 
@RMartinhoFernandes How can you even measure that with confidence? 700 ns is nothing. And how fast is my solution?
 
@RMartinhoFernandes mine was run on a public server, that's hardly a fair comparison :D
 
@FredOverflow I use Criterion.
It's built for this kind of measuring.
 
@RMartinhoFernandes actually, that's fast. Did haskell precompute a bunch?
 
@FredOverflow Yours is pretty much the same.
 
5:43 PM
yay
 
ideone.com/KMLaj here's my code thus far. Not verified for accuracy
 
@MooingDuck GHC has a heavy duty optimizer.
 
actually, I can verify it's wrong
ideone.com/D6Fqn is more likely to be right
 
flip flip tail
flip flip head
flip flip tail
 
5:44 PM
flip flip head
 
@MooingDuck yes, the solution is correct
 
@FredOverflow excellent
 
@FredOverflow It's the same because taking every third requires computing the two in between as well.
 
Now you've got a silly song stuck in your mind.
Flip flip.
 
@CatPlusPlus I've never heard the song. link? The song now in my head is cat dance with new words :/
 
5:45 PM
No.
 
@RMartinhoFernandes Are you saying takeEveryThird fibs can be computed directly, without the odd numbers?
 
@FredOverflow Yes, it can. But mine doesn't.
Mine is just a dumb filter of evenness followed by a sum.
 
ah darnit. I signed up to euler with <censored>@yahoo.ocm
 
user142019
I wrote sum $ map (\c -> read [c]::Int) (show (product [1..100])) to calculate the sum of all digits of 100!. Is there a better way to write that lambda? This feels a bit hacky to me.
 
@RMartinhoFernandes sounds like an interesting optimization opportunity, but probably not worth the effort
 
5:48 PM
I found a bug in project Euler! Once you sign in to an account without a validated email, EVERY PAGE is replaced with the email validation page. Including log-out. So I can't log out. Or log in. Or do anything. Maybe if I clear my cookies...
 
@WTP If you make the type of the function explicit, you don't need to give hints for type inference.
 
@WTP digitToInt?
 
(even though it gives me a link on that page to log out, it doesn't work)
 
@FredOverflow It's an interesting math exercise.
Work out a formula for the series F(3n).
 
0
Q: Const correctness and operator *

Pella86I defined a class like this: Quaternion& conjugate(); //negates the vector component of the quaternion Quaternion conjugate() const; //same but in without modifying the class... Quaternion& operator = (Quaternion const& Qrhs); Quaternion& operator *= (Quaternion const&...

Yuck design.
 
5:50 PM
@WTP sum $ map digitToInt $ show $ product [2..100]
@RMartinhoFernandes I've been trying for 30 seconds and then gave up ;)
 
@RMartinhoFernandes probably faster to calculate it the normal way
 
user142019
@FredOverflow Didn't know about digitToInt. Thanks!
 
@WTP I simply hoogled Char -> Int :)
 
user142019
Cool
 
@RMartinhoFernandes: by the way, when I timed mine at .02s, not only was that on a public server, thats with a resolution of .01s. :/
 
5:54 PM
lol
 
I'm going to try for a better timing, though I'm not sure I can top you guys
 
Who cares about the efficiency of Project Euler solutions as long as they run in well under a second? :)
 
@MooingDuck Sure you can. You're on C++. It's just that you have to work hard for it :P
 
Let's do it in x86 assembly! It'll take a couple of hours to develop, but maybe we can make it 2% faster!
 
@FredOverflow I Do! That's why I don't like Euler, and go to codechef instead
 
user142019
5:56 PM
What about using undocumented opcode hackery to speed things up?
 
Here is the most efficient version imaginable: solution = 4613732
 
What opcode hackery?
 
@WTP Funny you should mentioned that, I just learned about illegal 6502 opcodes the other day.
 
user142019
@CatPlusPlus hacks that use undocumented opcodes.
 
No shit.
 
5:58 PM
x87 has a fabs instruction, maybe we can somehow hack the a into an i?
 
Also, did I mention online judge thingies with no debug capabilities and dumb time restrictions are stupid?
 
You did now.
 
@FredOverflow You'll have more luck with hacking b into p.
Flip flip.
 
Isn't flip flip essentially id?
 

« first day (461 days earlier)      last day (4486 days later) »