« first day (1580 days earlier)      last day (3371 days later) » 

5:00 PM
you said it was ok!
vec3 pos = screen_transformation * vec3(position, 1);
gl_Position = vec4(pos.xy, 0, 1);
beh I'll try mat4
 
So that signifies it is not quite dead enough yet.
 
oh FFS GLUtil only provides glUniformMatrix4fv
is this a fucking joke
who the hell implements one out of 3 related functions, arbitrarily chosen
(meaning there are no mat3/mat2 versions)
 
(the second principle of induction)
it basically says that if you can prove an assertion is always true from n^0 to k (for some k >= n^0), then it must be true for k + 1
 
I want to go back in time when... Sudden Strike was released and show them that military strategy games in 2014+ will look like this
 
@Jefffrey No.
 
5:06 PM
and the assertion needs to be dependent on n, and n needs to ne natural
@R.MartinhoFernandes Oh, ok, good. What am I getting wrong?
 
@Jefffrey It says that you can prove <what you just said> + the base case, you can prove that it is true for all n.
 
@Jefffrey The k + 1 part, you have to prove it.
 
@EtiennedeMartel that's the first principle
@R.MartinhoFernandes what I just said included the base case, n^0 is the base case
 
@Jefffrey No, it doesn't.
 
@R.MartinhoFernandes also yes, so it must be true for k + 1 and forward too
 
5:09 PM
The implication doesn't require the left side to be true.
 
@AlexM. That was a CDV game. I liked their RTS games. I still like the ones I used to play. So much so that I bought all the Cossacks games and all the American Conquest games when they were on sale at Bundle Stars a while back
I never could get the hang of the Sudden Strike demos I tried though.
 
> if you can prove an assertion is always true from n^0 to k (for some k >= n^0), then it must be true for k + 1
 
I tried to play Cossacks
the art of war I think
 
Prelude Data.Vect.Float Hate> extendWith 1 m :: Mat4
Mat4 (Vec4 1.0 0.0 0.0 0.0) (Vec4 0.0 1.0 0.0 0.0) (Vec4 0.0 0.0 1.0 0.0) (Vec4 0.0 0.0 0.0 1.0)
so cool
 
it was set to a very high speed by default
got defeated in 3 minutes
 
5:10 PM
assertion is always true from n^0 to k (for some k >= n^0) => it is true for k + 1
 
@AlexM. That's ridiculous.
 
if the part on the left side is true, then the part on the right side is true
No.?
 
@Jefffrey and what's the question
 
@Jefffrey No, that is wrong. Proving the implication doesn't require proving the left side.
 
@BartekBanachewicz we need to be clear on this before I ask
@R.MartinhoFernandes of course it doesn't
 
5:10 PM
@Jefffrey Yes, but neither is required to be true.
 
ok
but if the one on the left side is true, then the one on the right side is true too
it is required in that case
 
you want to be able to prove for arbitrary n, so you prove for 0, and you prove that if for n, then for n+1 too
 
otherwise what the heck would you be demonstrating?
@BartekBanachewicz that's the first principle
 
@Jefffrey But induction cannot be used to prove that.
 
not the second
@R.MartinhoFernandes it's the second principle of the induction
or what I got from it
 
5:12 PM
@Jefffrey You use that fact to build inductive proofs.
Not induction to prove that.
 
yeah
so... are we clear that if I can prove that within a range (including the base case) the assertion is true, then it must be true from the end of the range onwards?
and that's the second principle of induction?
 
NO.
You might have the right understanding, but the way you formulate that is just wrong.
You have to prove that you can keep increasing the range. That's the important bit.
 
@Jefffrey The two parts of an inductive proof are: 1) prove X for a base case. 2) Prove that if X is true for the base case, it remains true for some extended version of the base case. Having done that, you've proven X for all of that type of extension of the base case.
 
ok, than please formulate it correctly in plain english trying to keep as much as possible from the one above
ok, guys
I understand the first principle of inductive proofs
I do
this is the second one
 
@Jefffrey Counterexample: P(n) = n < 5. You can easily prove P(0), P(1), P(2), P(3), and P(4). That says nothing about P(5). You cannot prove P(k) => P(k+1), though.
 
5:15 PM
there's a difference
@R.MartinhoFernandes oh I see
it's basically an hack
normally you would need to prove A(n^0) and that given A(k) => A(k + 1)
now it asks you to prove A(n^0), A(n^0 + 1), ..., A(k) => A(k + 1)
wrong?
 
@Jefffrey It's just a version of the first one that works with a implication that is sometimes easier to prove.
@Jefffrey Yeah, but sometimes that implication isn't easy to prove. This 2nd version lets you use induction with a weaker implication.
 
I see thanks.
 
{0.001953125, 0, 0.09765625, 0}
{0, 0.0026041667, 0.13020834, 0}
{0, 0, -0.1, 0}
{-1, -1, -100, 1}
wtf is the last line coming from
 
doesn't seem weaker though
@BartekBanachewicz StateT prolly
 
@Jefffrey lol. Have you seen the new shape sample I posted a bit above?
 
5:21 PM
in the second one you seem to need to prove actually more things
 
I wrote all of the calculations by hand granted
positionToMatrix (Vec2 x y) = Mat3
    (Vec3 1 0 x)
    (Vec3 0 1 y)
    (Vec3 0 0 1)
but this looks ok
 
this is a nice weapon skin zonait.tv/wp-content/uploads/2014/07/…
I have no idea what it has to do with Asimov though
the design might be a reference to the author or sth
 
@Jefffrey You have to prove more separate things, but each individual piece might (depending on the problem you're attacking) be enough easier to make up for it. For the CS-oriented, it's a bit like the case where insertion sort can beat quicksort if the input is already nearly sorted.
 
user1804599
@MartinJames no it can be the same opening.
 
user1804599
5:25 PM
 
user1804599
Works fine for hexagonal cans.
 
@JerryCoffin but you still have to prove A(k) => A(k + 1)
which is the most important part
 
@Jefffrey I called it weaker because it is easier to satisfy: if any of P(n_0), ..., P(k) doesn't hold, the implication holds. More "points of failure", so to speak.
 
I think I need an example
given A(n) = ^
@R.MartinhoFernandes oh, it's just because it's easier to prove it's wrong?
 
Something like that. Not sure how to express it. In my head, "it's weaker because implies less" makes total sense as an explanation, but I'm not so sure that can survive exposure to the world.
 
5:29 PM
@райтфолд Difficult to get all the mushy peas out of that little hole. If you're talking aluminium cans, like beer/coke cans, then I guess some sort of hex-ish can might have a point re. space-saving in packs, but without 100% recycling, would use more aluminium.
 
ffs why doesnt this work
 
"monad stacks are simple"
 
@BartekBanachewicz You refactored it? I did warn you :)
 
user1804599
they are terrible
 
@Jefffrey lol I'm doing math not monad stacks
@MartinJames It's a new feature
Added just after the refactoring
My matrix multiplication fucks up for some reason somewhere
I added mat4 version because of that retarded glutil:
positionToMatrix4 (Vec2 x y) = Mat4
    (Vec4 1 0 x 0)
    (Vec4 0 1 y 0)
    (Vec4 0 0 1 0)
    (Vec4 0 0 0 1)
 
user1804599
5:31 PM
they require either immense amounts of boilerplate or create extreme coupling
 
let orthoScreenMat = orthoMatrix (0, 1024) (0, 768) (-10, 10)
let requestMat = toMatrix4 . transformation $ d
let drawMat = orthoScreenMat .*. requestMat
liftIO $ setUniformM4 pip "screen_transformation" drawMat
I can't readily see what's wrong there
 
6
Q: c++ access static members using null pointer

meetRecently tried the following program and it compiles, runs fine and produces expected output instead of any runtime error. #include <iostream> class demo { public: static void fun() { std::cout<<"fun() is called\n"; } static int a; }; int demo::a=9...

What do you think about this topic /cc @FilipRoséen-refp
 
um wait so should the x/y be in the last columnt actually? :S
because the z is 0, I want the w to be 1 and add basing on that
    (Vec4 1 0 0 x)
    (Vec4 0 1 0 y)
    (Vec4 0 0 1 0)
    (Vec4 0 0 0 1)
meaning this is the correct version
halp :/
 
@Columbo +1, that's a TIL. One I don't agree with, though. What's the point of not yielding UB when *p is evaluated an p is nullptr?
 
what the hell i dont even
 
5:45 PM
Also, what about *p = x? There no lvalue-to-rvalue conversion for the lhs, yet this is be UB
 
@BartekBanachewicz you still don't have textures?
 
ah, "or reference bindings"
 
@LightnessRacesinOrbit I had textures working already but I'm introducing new transformation calculations
 
@AndyProwl What's the point of it being UB? There is nothing inherently wrong with it, as long as you don't use the resulting lvalue.
 
@Columbo With *p = x?
 
5:47 PM
@AndyProwl No, *p. (Corrected the response).
 
@Columbo Why allowing something that can never be used nor yield any meaningful result?
 
@AndyProwl It can be used, see the question. :o)
 
*p is supposed to yield an lvalue, but the point of lvalues is to represent objects. This is a non-object.
 
@AndyProwl lvalues can refer to functions.
 
@Columbo Yes, ok, but they do refer to something
@Columbo That should have been written my_class::static_function() or my_class::static_member. I don't see the point of allowing indirection on a null pointer.
 
5:50 PM
@AndyProwl It said that jokingly. :o) is a clown-face smiley.
 
@LightnessRacesinOrbit transposition
 
@Columbo Ah. Ok, I lack the linguistic knowledge :P
 
I was working row major
OGL is row major
GLU is col-major
 
> Rationale: We agreed the example should be allowed.
Yeah awesome, thank you guys.
 
5:52 PM
@BartekBanachewicz Where?
 
@R.MartinhoFernandes or the other way around really
my sample works and it's all that matters
 
No, I mean, which part of it has anything that lets you observe row majority?
 
@R.MartinhoFernandes welp, the fact that I have to transpose one of the matrices?
 
What for?
You can fix the shader.
 
@R.MartinhoFernandes to achieve proper results?
 
5:54 PM
@Columbo: On the same token, why forbidding auto& x = *p; but allowing *p?
 
@R.MartinhoFernandes the shader only receives multiplied-out uniform
I was multiplying projection matrix by a transformation view matrix
the projection matrix from the library was transposed
 
@AndyProwl Because on many systems such as e.g. x86, references are implemented via pointers. And loading an invalid pointer value into a register might trap or sth.? IIRC?
 
@BartekBanachewicz Yeah, and that is not inherently row major nor column major.
 
@R.MartinhoFernandes no, but the library I use gives me the ortho matrix that was wrong
 
So, nothing OpenGL-related.
 
5:56 PM
well yes and no, it's an "OpenGL Utility" library
@Jefffrey was simpler than anticipated (sample_shape works)
 
@Columbo Not sure I understand. If references are implemented as pointers, loading a nullptr value should not cause any troubles - but I'm not an implementer, so I don't know. From a language perspective, allowing *p "because you don't read the value" but forbidding auto& x = *p "because the pointer is invalid" is inconsistent
 
@AndyProwl That is not an actual standard argument.
 
The implementation of references is unspecified.
 
@Columbo You're missing the whole point.
 
5:58 PM
@AndyProwl Emulating static methods from ancient times where static methods were not a thing. (I'm fairly sure this is true, but I can't find the source at the moment)
 
He's not interested in what piece of standardese makes it so.
He's interested in reason.
 
@Columbo I wasn't pretending it to be one
 
@R.MartinhoFernandes I see.
@AndyProwl kk, hold on
@AndyProwl You might be right. I am not denying that this whole topic involves inconsistencies. I'm just trying to understand the current modus vivendi the committee agrees upon, not so much what is reasonable.
 
@milleniumbug That sounds like a valid explanation, but it's a horrible motivation IMO :(
 
cool
now I can add more pipelines
 
user1804599
6:02 PM
I think I have found one of the secret ingredients to a less terrible web development experience.
 
@Columbo Yeah well, as I wrote, you taught me something. I just think it's something I wouldn't have wanted to learn ;)
 
@райтфолд do share
 
@AndyProwl What did you learn!?
 
user1804599
Do all UI client-side with virtual DOM and a single global setState function that completely rerenders the DOM with new state.
 
@Columbo That *nullptr is not UB
Which IMO is total non-sense but well, one got to know how things work
 
user1804599
6:03 PM
Of course it's not UB.
 
user1804599
It's a type error.
 
@AndyProwl Oh, cool. I thought you disagreed with my standardese - excuse that misunderstanding :)
@AndyProwl I think Deduplicator is pissed off
"Dereferencing a null pointer doesn't invoke UB without further lvalue-to-rvalue conversions (=accesses to stored value) or reference bindings" that's what some want, not what actually is. Happy with my extending the quote? — Deduplicator 17 mins ago
 
@райтфолд Yeah, well, I meant *p where p is a null pointer
@Columbo No, your Standardese is fine as usual
 
user1804599
@AndyProwl I know. :D
 
lol
 
6:04 PM
haaaa
it works!
 
0
A: When would dynamic scoping be useful?

EyvindException handling in most languages utilizes dynamic scoping; when an exception occurs control will be transferred back to the closest handler on the (dynamic) activation stack.

This is nonsense, right? Just checking.
 
    pip <- case pipeline d of
                SolidColorPipeline _ -> gets solidColorPipeline
                TexturingPipeline -> gets texturingPipeline
fuck yeah
 
It’s dynamic alright, but not scoping.
 
now only have to fix texturing
 
@Columbo I don't think he's correct. Your quotes are quite clear.
 
user1804599
6:07 PM
@FredOverflow I use dynamic scoping for permissions.
 
@FredOverflow Something like 'with dynamic scoping, you can emulate the control flow of exceptions' would perhaps be more carefully phrased.
 
> passing contextual parameters without having to add new parameters explicitly to every function in a call stack
lol learn to monads, you scrubs
 
@райтфолд Reader Monad?
 
user1804599
permissions is a dynamic variable. I start with permissions being the empty set. When I acquire the session ID I look up the user and populate permissions. Then when I need to acquire data I read permissions.
 
user1804599
This works very well.
 
6:08 PM
eh, still feels like a stretch
 
user1804599
I can always narrow or broaden permissions as I please.
 
user1804599
Especially narrowing is sometimes useful.
 
user1804599
Now of course dynamic variables must be thread-local.
 
user1804599
(Otherwise it's retarded beyond retardation.)
 
@райтфолд Are you single
 
user1804599
6:10 PM
Yes, why?
 
user1804599
And they must not be definable implicitly.
 
user1804599
E.g. void f() { print(x); } void g() { int x = 0; f(); } should be an error.
 
user1804599
Instead, you want dynamic int x; void f() { print(x); } void g() { x = 0; f(); /* x automatically reset at end of scope */ }.
 
@Columbo Are you ?
 
@FredOverflow No, I'm
 
6:13 PM
Is that a brand of Vodka?
 
user1804599
Singletons are great.
 
user1804599
Imagine you couldn't have singletons.
 
@FredOverflow "Singletoff Vodka - For the loner"
 
> Why did the programmer quit his job? Because he couldn't get arrays.
lol
took me a while
 
user1804599
Functions would have to return integer instead of unit. :o
 
user1804599
6:16 PM
@FredOverflow much more cumbersome than dynamic variables.
 
user1804599
I have never used dynamic variables for dependency injection. I should give it a try.
 
user1804599
Might do that in Agluj instead of passing things to main.
 
javascript:void(0);, why do I see that everywhere
 
@райтфолд How about implicit parameters instead? ;)
 
Illuminati confirmed?
 
user1804599
6:16 PM
@Columbo No idea. It's a syntax error.
 
@райтфолд ...for stateless object, right?
 
@райтфолд Fixed it
 
user1804599
@FredOverflow Yes.
 
@Columbo Is that a label, followed by a cast to void?
 
user1804599
NullInputStream, NullOutputStream, Nil, None and () are great examples of good singletons.
 
6:17 PM
@FredOverflow That's not C++
 
Does JavaScript not have labels?
 
user1804599
It doesn't AFAIK.
 
user1804599
javascript: is a pseudo URL scheme used to execute JavaScript code.
 
user1804599
void is an operator which evaluates the operand and returns the undefined value.
 
user1804599
It's more reliable than the identifier undefined which can be reassigned. (lol javascript)
 
6:19 PM
lol
 
user1804599
CoffeeScript and LiveScript have undefined as keyword and translate it to void 0.
 
interesting
 
user1804599
undefined is silly.
 
Have you watched Rick and Morty? What is your opinion on the show?
 
user1804599
It is used when reading non-existing object properties, when indexing arrays out of bounds and when returning from functions with return; or }.
 
user1804599
6:20 PM
It's absolutely terrible.
 
user1804599
The first two should throw exceptions and the last one could just return null.
 
@райтфолд undefined or Rick and Morty? :)
 
user1804599
undefined.
 
Can you keep a secret?
 
user1804599
Nice.
 
user1804599
6:22 PM
pickBeeper();
turnLeft();
moveToWall();
dropBeeper();
turnAround();
moveToWall();
turnLeft();
 
That's 7/7 points!
 
@AndyProwl After rethinking I start to believe that auto& r = *(int*)0; should be well-formed, too.
 
@Columbo "should be" as "I think the Standard makes it well-formed"?
 
@AndyProwl No.
 
user1804599
@FredOverflow woohoo!
 
6:24 PM
@AndyProwl The standard specifies it to be UB right now
 
@Columbo Well, I don't agree (I think it ought to be UB, in fact I think *p should be UB when p is nullptr), but at least it would be consistent.
 
I'd be more interested in your solutions to exercises A to E on pages 7 and 8.
 
user1804599
I like to pickBieber and dropBieber.
 
Reference binding is an odd case because there the standard definitely doesn't mean what it says. What it currently has ("A reference shall be initialized to refer to a valid object or function.") would require a diagnostic every time that rule is violated, which is obviously impractical. — T.C. 37 mins ago
 
user1804599
@FredOverflow ok lemme check
 
6:25 PM
A lot of students hat much trouble with those, especially D and E.
And the solution to A was almost always ridicilously overcomplicated.
 
user1804599
What language is that?
 
German, C
 
@AndyProwl Just the fact that this seems to be a matter of opinion is weird. Surely there are pratical considerations?
 
user1804599
Isn't int matrix[9] in a parameter list just int* matrix?
 
user1804599
6:25 PM
You should use static.
 
@Columbo The only one I've read so far is "there is a lot of code out there that relies on it". Not a good one IMO.
 
user1804599
:(
 
user1804599
well then let's try
 
I'm caught in a SO dilemma though. Is it OK to close that Q as a duplicate of another one whose accepted answer is incorrect?
I'd rather close the other one as a duplicate of this one
 
6:27 PM
@AndyProwl Hihihi
@AndyProwl Just what I asked T.C. a while ago in the comment section of the above Q, then deleted that comment
 
@AndyProwl What's keeping you from doing that?
 
Thought of the same thing
 
@FredOverflow The fact that I don't know if it's correct. (I've done it right now)
 
@AndyProwl It's fine.
 
@Columbo Just as a note, it seems the second CWG issue you quote didn't make it into the Standard
 
6:30 PM
@AndyProwl I know. That is irrelevant because my answer doesn't rely on the resolutions they proposed, but on the rationale they gave
The rationals are legitimate nonetheless
 
user1804599
@FredOverflow I give up, it's difficult and most uninteresting.
 
user1804599
I'd just use a matrix library that offers a rotation routine.
 
user1804599
Let's look at E.
 
@райтфолд Fascinating. I think I'll use excercise A as my personal FizzBuzz interview question, should I ever need one.
E can't be solved (easily) without D.
Try D first.
 
@Columbo Well, if you go and look into those rationales, two comments out of three seem to be against, and the one in favor doesn't seem so legitimate (it also supports other things like taking the address of an "empty lvalue", which is illegal).
> Simply forming the lvalue expression, and then for example taking its address, does not trigger either of those errors
 
6:35 PM
@Columbo Rationals like 22 over 7? ;)
 
user1804599
int cmpchr(void const* a, void const* b) {
    return *(char const*)a - *(char const*)b;
}

int anagrams(char a[], char b[]) {
    if (strlen(a) != strlen(b)) {
        return 0;
    }
    qsort(a, strlen(a), 1, cmpchr);
    qsort(b, strlen(b), 1, cmpchr);
    return !strcmp(a, b);
}
 
While mentioning the CWG issue is OK as a note, it should not be used to support the status quo
(IMO at least)
 
user1804599
That was pretty easy.
 
We did not cover pointers or function pointers ;)
 
user1804599
In C++ I'd convert the strings to std::unordered_multiset<char>s and compare them with ==.
 
6:36 PM
Nice
 
Why not std::sort the std::strings?
 
@AndyProwl We're talking about the second one, right? 232?
 
user1804599
@FredOverflow I find the multiset approach clearer.
 
@Columbo Yep
@FredOverflow Also nice
 
user1804599
My favourite definition of "anagram" is "have the same character multiset."
 
6:37 PM
How about std::is_permutation
 
user1804599
@AndyProwl Even nicer!
 
user1804599
@FredOverflow Not my problem!
 
user1804599
@FredOverflow OK let's try D.
 
@AndyProwl Mike essentially doesn't want null lvalues while null references are not permitted (as this is inconsistent and counterintuitive, as mentiond by you). If both were to be made well-formed... anyway, I have to revise some Further Pure 3
 
user1804599
void count(char* s, int* n) {
    memset(n, 0, 128);
    for (size_t i = 0; i < strlen(s); ++i) {
        assert(s[i] < 128);
        ++n[s[i]];
    }
}
 
6:39 PM
@Columbo I think the right approach to this issue is "fuck C++".
 
@AndyProwl Well, C++ tries to fuck with you, so... I'm just sayin'
 
Self-defense it is
 
user1804599
@FredOverflow D is easy too.
 
@райтфолд Do you see anything wrong with i < strlen(s)?
 
user1804599
No.
 
6:42 PM
It makes count O(n^2).
 
user1804599
Compiler can easily verify in this case that s doesn't escape.
 
user1804599
And there is no synchronisation.
 
user1804599
So it optimises it to a single call to strlen.
 
@райтфолд Fuck C
 
user1804599
And s and n cannot be aliases in C AFAIK.
 
6:43 PM
Also, you only set the first 25% of n to zero :)
 
user1804599
Right.
 
user1804599
Is it meant that students first set everything to zero?
 
@FredOverflow lol, I was just about to moan about the magic 128;)
 
user1804599
Or is it a precondition that all elements are zero when passed in?
 
@райтфолд Yes, but they only get 1 point penalty if they forget it in both D and E.
 
user1804599
6:43 PM
OK.
 
user1804599
I don't use count in E. Do I get extra points?
 
Careful what you wish for, 10 points plus 1 point might overflow ;)
 
user1804599
Must be a horrible data type.
 
user1804599
11 isn't a power of two!
 
What if I use a guitar amplifier to represent points, and what if I am not a band member of Spinal Tap?
 
user1804599
6:46 PM
@FredOverflow let's assume the program runs on an architecture where sizeof(int) == 1.
 
@FredOverflow I nearly fried mine again yesterday ;/
 
What did you do? Play a Monad tutorial on the guitar?
 
joy of joys... I have to learn objective C
 
@FredOverflow I switched the power switch immediately after the standby switch
 
user1804599
@Mgetz Nice.
 
6:49 PM
@Mgetz RIP Mgetz. IMO that's worse than Java.
 
@sehe long term goal for me as best I can tell is to eventually port to Xamarin
unless they don't want to pay the license
then C++
 
user1804599
@FredOverflow how'd you solve A?
 
user1804599
I thought of memcpy, bunch of assignments, memcpy.
 
So, there's gonna be an Assassin's Creed film in 2016.
Isn't that exciting.
 
user1804599
No.
 
user1804599
6:54 PM
There already are Assassin's Creed films.
 
I mean, a real one. Slated for december 21st, 2016.
Also, there is such as a thing as Ubisoft Motion Pictures.
 

« first day (1580 days earlier)      last day (3371 days later) »