« first day (474 days earlier)      last day (4467 days later) » 

5:04 AM
@LeviMorrison Yeah, you also need to link to libboost_system.
 
This is what a dumb translation like the one on wikipedia looks like: pastebin.com/EgAPN1p7 This looks easy to automate, but is not that pretty.
 
in a sense, I'm not too bothered about pretty
but what I am bothered about is things like respects non-POD types, semantic actions for later shifts can use variables from previous semantic actions, etc
 
I don't see what's the problem with non-PODs.
 
I thought LR parsers couldn't inherit actions
 
I suppose that's mainly a silly bison restriction because of C something.
 
5:07 AM
oh, I don't know if there even is a problem with non-PODs in your code
I haven't finished reading it
 
I would stick to S-attributed if you are making LR
 
But yeah, passing data to semantic actions needs some work.
 
by the way
the problem with non-PODs is in the result struct
 
because you've used the same struct everywhere
but that's not going to work when two different rules need two different return values
 
5:10 AM
Make symbol polymorphic?
 
I mean, I guess you could use a boost::any instead?
but not exactly what I was looking for
I wanted something without run-time type switching, as all the types are known at compile-time
 
yeah
that's what I've been thinking
 
Well, those 6 upvotes disappeared. I guess they were reverted or something.
 
maybe I'll just trace the rules to see if they can be left-recursive
 
5:16 AM
That counts as an optimization (less stack used), so, why not?
 
cause it kind of boggles my mind :P
 
afk, foraging for foodstuffs.
 
kk
 
Hmm, when you open this page en.cppreference.com/w/cpp/algorithm/sort is the real content very far down?
 
no
 
5:27 AM
It's below the fold on my 800-high screen.
 
looks pretty normal
browser?
 
I see a bunch of whitespace
 
Chrome
 
@Pubby Firefox too?
 
5:27 AM
No, Chromium
 
user406009
I think you see the whitespace due to their stupid sidebar.
 
user406009
See if you can find the mobile version of the site.
 
16.0.912.77
 
Thing is, en.cppreference.com/w/cpp/algorithm/count doesn't have that problem.
 
If I zoom out it's normal. Probably due to small screen size
 
5:29 AM
ok
I have never written any program that traces a graph before
 
@Pubby Ah, that's true.
 
Nobody seems to care about 15" screens anymore :(
 
@DeadMG What do you mean? Your data structures and algorithms courses didn't cover graphs?
 
never took any data structures course
 
5:30 AM
besides, it's not that I don't understand it, it's that I can't visualize the code
never mind, I think I got it
 
:)
@DeadMG So, when you say your degree sucks, it seems it kinda does.
 
gee, ya think? ^^
 
Ok, I think I'm going to watch some more BSG. I'm liking it.
 
lol
 
Yeah, I heard it's good.
Well, fuck, the seventh series of Doctor Who only begins in fall 2012.
 
5:52 AM
If anyone has 5+ upvotes in the gdi+ tag, will you consider approving the synonym proposal: stackoverflow.com/tags/gdi%2b/synonyms
 
getting exposed to Haskell is making me look into places like <algorithm> to transform my data rather than cranking out my own loops...
 
for loops are harmful? ;)
 
over time, I'm becoming more allergic to them - transform via function+lambda ftw
 
What I don't like about <algorithm> is that everything works in-place.
 
that's what I thought - but I'm looking at remove_copy_if() atm...
 
6:04 AM
But that's a side-effect of "pairs of iterators" not being easily composable.
 
ic what you mean - it's annoying that I need to pass in the result iterator (eg my_vector.begin()) to hold the result - Haskell prolly just returns a brand-new-result to you, I would guess...
at least copy-elision will allow me to return this sucka by-value (a cheer for C++11!)
 
The problem is, you can't return a std::vector: what if you want a std::list?
A reasonable solution would be to return a pair of iterators. You can build pretty much any container with that.
But the problem is, you can't do std::vector(f()), because std::vector takes two iterators, not a pair of them.
Nor can you feed those iterators to another algorithm.
 
Does Haskell have a solution to this type of problem?
 
The solution is to not have a range as two objects, but as a single one.
 
ic - encapsulate it better
 
6:18 AM
:2520188    Do you know when i should call idelete for this function:
ilist iappend(ilist il1, ilist il2){
ilist acc = iempty();
while(!iempty_huh(il1)){
    acc = icons (ifirst(il1), acc);
    il1 = irest(il1);
    }
while (!iempty_huh(acc)){
il2 = icons(ifirst(acc), il2);
acc = irest(acc);
}

return il2;

}
 
are all the i's in there intentional?
ilist iappend ...
 
question 4
they basically gave is those i functions
and i need to use idelete to free memory, to avoid an error ... but i dont know where to call idelete :(
question 5 i mean
 
just from that code, it isn't clear that anything is being allocated
 
basically icons allocates memory
i need to free it so i dont get an error, with the fucntion idelete
 
6:34 AM
what error are you getting?
 
a long heap summary error ...
from interaction window i guess
 
are you talking about a compile error, or some kind of stack dump at runtime?
 
@renatofernandes You need to call idelete when you are not using ilist variable any longer.
 
interaction error
@AzzA hmmm arent i always using it since im producing an ilist
 
what compiler are you using?
 
6:40 AM
on a linux ...
its because i didnt use idelete in the right spot that is why..
 
@renatofernandes When you use ilist variable, it allocates some memory. When you no longer need this variable, you want to free this memory. I did not see implementation of ilist, it might be doing it automatically in destructor. But if it does not, you should manually free memory. And I think that is what idelete does.
 
Oh good, there are people here
 
Wait, this is C, not C++? Then there is no destructor, so you NEED to call idelete
 
@AzzA im still confused where in my code i should call idelete thou?
yes i need to call it
 
Call it before ilist variable goes out of scope. I think, in your case it's before return 0;from main()
 
6:43 AM
so not im my function itself?
 
Can this question be reopened? It wasn't all that hard to understand, and I have a solution I can't post because ppl closed it.
-5
Q: Fast computation of multi-category number of combinations

CoderI have to evaluate the following formula for permutations with repeated objects n!/(r1! * r2! * r3! * ......... * rn!) wheren <= 500 and 1 <= ri <= 10 (there are n objects in total out of which r1 are alike of 1 kind , r2 are alike of 2nd kind and so on and the formula indicates the n...

 
cause i have ui test file where im testing the outputs ... while my funtion is in a .h file
 
user457812
@renatofernandes Did you look through the functions you were given to see what idelete does and what the other functions do that might require its use?
 
apparently when i call icons its allocates memory, so i want to use idelete to free the memory so i wont get an error
 
user457812
So do that.
 
user457812
6:53 AM
Also, whoever wrote that ilist stuff needs to be tortured or something for crimes against my brain.
 
user457812
Granted that means I'm also guilty and must be tortured, but so be it.
 
@renatofernandes Assignment 5 Problem 4. 10 marks. File: ilist.c?
 
@RMartinhoFernandes auto_cast?
 
Is that Turbo C++?
wow...
 
According to the comments it is.
 
Is it bad that I recognized Turbo C++ (well, I actually recognized Turbo Pascal, but it's the same thing)?
 
You get geek points.
 
I think not. Everyone used it.
 
7:22 AM
Whether or not that is a bad thing is up to you to decide :)
 
I mean, everyone of a certain age....
So, you are just old, @RMartinhoFernandes. hehe...
 
A computer running turbo C++ can access SO?
 
There's DOSBox.
 
Why would you want to do that?
 
Makes me want to play Prince of Persia...
 
7:24 AM
It probably runs faster on DOSBox today than it ran when it was all the rage.
 
8:15 AM
I love C++, and I use it a lot :)
We had long discussions about this with a colleague of mine
He mainly develops complex algorithms without any need for performance
and I develop algorithms that are slightly less complex but they crave for performance
Our conclusion (after months of discussion) was that higher level languages like Python make you feel more free, and allow you to write more maintainable code, but the moment you need performance, the things you'll have to do in them make your code much worse, and even then you won't achieve C++ speeds.
It all depends on the trade-off your current project dictates
complex algorithms, no need for performance -> Python etc.
simple algorithms, need for performance -> C
complex algorithms, need for performance -> C++
In its own category, C++ has no rival, really
 
C fails as soon as you get to algorithms as "complex" as what powers std::vector.
 
Algorithms have nothing to do with the language.
 
how come?
 
Well, they simply don't. Some Tikhonov Regularization has nothing to do with language it's implemented in.
 
@AzzA: if you take into account maintainability (and thus readability), support for basic building blocks, ..., that is simply not true. It's only true if you look to the narrow space and time complexity part of the algorithm, but then you're just being theoretical, not practical.
 
8:28 AM
What you call an "algorithm", I think, is "data management" for this algorithm.
 
This discussion again depends on what field you're working in
In computer vision, you usually write long algorithms
in the end, you want them to look like the pseudo-code, otherwise it will be very hard to debug and maintain
but it needs to be high-performance too
I know that writing it in Python will not change the complexity
but it will make it run possibly 1000 times slower
 
@AzzA Since when is data management and data complexity not a crucial part of Algorithms? Back when I was in university, the first part of our algorithms class was "data structures" because that really leverages your algorithms.
 
What language does Knuth's book use?
 
MIX.
MMIX in the new version.
 
Nobody reads TAOCP for MIX
 
8:36 AM
@AzzA I don't see how that matters. I am also not defending C++ because I do not believe it to be the sole holy grail for complex algorithms, I'm just stating that data structures and basic availability of those are important for implementing algorithms (hence @RMartinhoFernandes's comment about std::vector and C).
 
Exactly, he does it in MIX for a reason - because he talks about algorithms, not C/C++ etc implementations of it...
 
He uses MIX to talk about computers, not algorithms
 
I had cold hands yesterday cycling in to work. Why the hell did I not put on gloves today, when it is even colders!?
 
tc;dr
 
8:38 AM
When there's matrix operations and complex mathematical expressions are involved, I'd like to see how that would look in MIX
 
Well, in my view, if I need to rotate a vector (mathematical) I need to multiply it by a rotational matrix. This is "algorithm"... I can do it in C with pointers to memory, I can do it in C++ with std::vector. The algorithm is the same.
 
BTW, I'm not saying C++ is the holy grail for complex algorithms either, but it pretty much becomes the only option if you'll need to get that last drop of performance
 
I find MIX to be actually horrid to showcase algorithms.
 
well, there is always going down to hardware specific optimisations, but that's silly talk
 
If all you need to do is to rotate a vector, yes you can call a function with pointers
but if you have 10 lines of long expressions that you have to write
and if you'll need to hunt down a bug caused by a 1/2 used instead of a 3/2 somewhere inside them
you cannot live with all those parantheses and ugly syntax
The ugliest kind of debugging, IMHO, is debugging mathematical equations, which sort of work even when there's a bug
 
8:43 AM
But algorithm does not change. It might take 4 lines in C++, it might take 1 line in FORTRAN (maybe). It might take 20 lines in C. And whole bunch of lines in assembler. But it does not change algorithm, which is logic!
 
@AzzA Yes, but in a real project you don't only care about the algorithm (you don't need more than pseudocode to have an algorithm). You care about maintainability and possible optimizations and how these are in balance. Just caring about "the algorithm" is awfully theoretical :p
 
think about this
debugging a function gets exponentially harder
when the number of lines increase
 
You need to use different logic to implement algorithms in different languages.
 
Yes, that's why @enobayram argument with his colleague was NOT about algorithms. That's all I wanted to say.
 
I don't understand your point
If you're -designing- algorithms
 
8:45 AM
It is however about the implementation of algorithms, and say what you like, without implementations algorithms are as useful as string theory.
 
then you don't need programming language at all.
 
it's very important how easy it is to modify and debug your implementation
How come
you're designing a statistical inference algorithm for Bayesian networks, say
 
if you are -designing- algorithms it's not about programming language. it's about logic, essentially.
 
You've all these heuristics that you hope will make the state converge in a reasonable time
You are in a constant cycle of re-designing and re-implementing
 
Speaking of logic, is prolog any good at algorithms?
 
8:48 AM
What algorithms?
 
All of them? Hehe
 
:)
My point is; I cannot know about other people's fields, but in anything that comes close to AI, the algorithms that can run in any reasonable time end up being probabilistic and full of heuristics. You hope that it will converge to something sensible, so you keep trying new things. It's also very hard to debug, because you don't know what the result should be, and most "algebraic bugs" (if you know what I mean) result in almost working code.
You've an estimate that's, say, %2 off, because a -1 instead of a +1 introduced a statistical bias somewhere...
 
Maybe we are talking about slightly differnt things, or, rather, define things slightly differently
 
Very likely
 
9:03 AM
Say, problem: find sum of all natural numbers from 0 to user-specified N. Algorithm#1: just sum them all. Algorithm #2: use equation for sum of arithmetic series. These are two different algorithms. Now, you can implement them using different languages.
 
if you what you need to do is simply N*(N+1)/2
yes, you can use any language
 
But you see my point?
 
@enobayram Try doing that in Bra*nfuck.
 
I didn't look into the syntax of Bra*nfuck, is even that really hard ? :)
@AzzA I see your point
if you're spending %90 of your time thinking about your algorithm
then it doesn't matter which language you implement in
 
@RMartinhoFernandes I like where you put * in your Brainf*ck. Brain is offensive, isn't it? ;)
 
9:08 AM
They can all do it
 
I think, since you are working developing AI, you spend a lot of time thinking exactly about logic of algorithms...
 
@AzzA If the word "Brainfuck" is offensive, it should be ok to censor any part of it I want, shouldn't it?
 
solved pathfinding problem yet? ;)
@RMartinhoFernandes I suppose :)
 
:) I'm not working about it. When I say AI, I also include things like computer vision in it.
 
You mean, image processing/recognition, that sort of thing?
 
9:12 AM
yes, I guess when you say image processing, it means image goes in image comes out
computer vision is more like image goes in semantic information comes out
 
And, by the way, I DLed Prince of Persia and DOSbox. In 20 minutes playing I still couldn't find sword. dammit...
I see
 
I couldn't stand playing Prince of Persia when I was a kid, because the seeing those spikes go through his knees (when you fall on them) made me feel terrible
 
:)
I mostly played Captain Comic though when I was a kid... It was flashier to my liking...
 
Ahhh, I have completely forgotten about this game :)
The UI was so special in this game, you've all that stuff around the main game view
 
@RMartinhoFernandes 0_o, that's really magical for me :)
@RMartinhoFernandes you're working on any project these days?
 
I'm doing stuff for class. I am working on a memory manager, and next up is a shell.
 
@RMartinhoFernandes That's open source? you need some junior artists? :)
 
I solved this once already, but now I'm doing it in C++. If you want to help, I don't mind.
 
@RMartinhoFernandes How can I help? you need to instruct me
 
9:43 AM
I'm writing a series of blog posts (in Portuguese, my audience is classmates) while I solve the class exercises. I have a repository online at hg.tumtumtree.me/so, but I still need to push some code. We use Unix system calls, so it helps to have a Linux system, or something.
 
mawning
 
@RMartinhoFernandes I've never messed with unix calls, I'll contact you back after seeing the project overview, and getting gist of it , Thanks a lot :)
@TonyTheLion pawning :)
 
@TonyTheLion Hey. I made this imgur.com/RZp3S to explain move semantics. Don't mind the silliness.
7
 
@RMartinhoFernandes awesome way of teaching :)
 
@RMartinhoFernandes you deserve a star :)
 
9:53 AM
I finally honoured this question with an attempt at answering:
0
A: more spirit madness - parser-types (rules vs int_parser<>) and meta-programming techniques

seheI'm not so sure I get the full extent of the question, but here are a few hints The line commented with // THIS is what I need to do. compiles fine with me (problem solved? I'm guessing you actually meant assigning a parser, not a rule?) Initialization of function-local static has been defined ...

 
Ah, the famous "He asked for C++, not Perl."
 
man
university depresses me
 
10:11 AM
@RMartinhoFernandes The famous, anyway. Somehow that question got +71 - I can't really comprehend what problem he was trying to solve. I do see that he was trying to copy/assign/share parsers instead of rules (but that reminds me of people trying to polymorphically store any function/function without wanting to use std::function; It can be done, but it won't gain anything)
 
Wait, what?
Yeah... it's at freaking 72. I didn't notice.
That's weird.
I like "my question is in bold at the bottom", and then the bold part reads "My question is, how do I solve this problem ?".
3
 
@RMartinhoFernandes the only reason I made an attempt at answering is because someone bothered to set a bounty
 
Wait, it wasn't the asker?
 
@RMartinhoFernandes Yeah. I think that was the punchline that kept me from answering anything in the past.
@RMartinhoFernandes Nope. A tuergeist
tuergeist, Germany
1.7k 3 19
 
I admit that I don't understand half of what is in the question, but it doesn't sound that interesting.
 
10:19 AM
btw, it's impossible to copy parsers in spirit, as impossible to use auto with them
they creates temporaries which dies after assignment
it's like auto foo = string("..").c_str();
 
@Abyx const auto& expression = expression; // no problem
 
@sehe try it with string("..").c_str()
 
@Abyx why? That has no relevance. More like
const auto& foo = string("..") + ".";
std::cout << foo.c_str() << std::endl; // fine
 
anyway I didn't read that question on spirit and don't know what it's about
 
@Abyx Ha. I did read it, and can hardly decide what it's about
@Abyx Tell me about this stuff. Yesterday I tracked a spirit karma bug down to a stale temp reference svn.boost.org/trac/boost/ticket/6126#comment:13
 
10:28 AM
@sehe can't get how it works %)
 
@Abyx google (SO) lifetime extension of local const references to temporaries
It's one of the more obscure 'unintuitive' language features, but much of the language (including the whole machinery of expression templates in general) depends on this subtle feature
 
well.. maybe it's possible to catch spirit parsers with const auto&
 
I'd usually go for auto&& myself
 
@Abyx definitely so. Anyways, you can catch them with auto x = some_parser_expression
 
10:43 AM
@sehe no, you can't use auto x =... with spirit.
 
@Abyx Remember, auto is a type specifier, so it declares a variable. So auto x = is not assignment but initialization. Case closed
 
it works with g++, but fails VC++. because of temporaries
 
@Abyx mmm. interesting. looking over
That talks about BOOST_AUTO. Is it an issue for MSVC 2010 with auto? It shouldn't be, methinks
 
there is the issue with auto in VC++
 
@Abyx oh. makes me happier I'm not using it ATM
@Abyx Link?
 
10:50 AM
no link... maybe I still have some code reproducing it..
 
Oh, I see:
> I just tried this with MSVC10 Beta 2 and boost 1.41 beta 1. It works fantastic in debug builds, but for release builds I get an access violation inside qi::parse, no matter how simple or complex the grammar/rule. I don’t know if this is a codegen bug with MSVC, or if there’s undefined behavior occurring somewhere inside spirit, but this trick is effectively useless for me
That's all quite old of course. I may try my hand at this on my own VS2010 installation later
 
ah.. just reproduced with the code from that article
#include <boost/spirit/include/qi.hpp>

#include <iostream>
#include <string>

int main()
{
    using namespace boost::spirit::qi;

    auto comment_p = "/*" >> *(char_ - "*/") >> "*/";

    std::string str = "/*This is a comment*/";
    auto iter = str.begin();
    auto ok = parse(iter, str.end(), comment_p);

    return !(ok && iter == str.end());
}
let's try with const auto&..
.. same crash
 
auto&&?
 
@DeadMG still crashes
 
strange, that should be valid
 
10:55 AM
@DeadMG depending on the amount of actual UB in the classes under test, but in principle, yes
 
sure, but I can't imagine any such UB
 
@DeadMG Just simple things, references to locals, missing returns, illegal casts. The stuff that may 'work' until you push it beyond the limits where compilers usually happened to 'do what you expect'
30 mins ago, by sehe
@Abyx Tell me about this stuff. Yesterday I tracked a spirit karma bug down to a stale temp reference https://svn.boost.org/trac/boost/ticket/6126#comment:13
 
@sehe ..tell what?
 
@DeadMG ^^ that is actually quite a good example of it, where it 'usually works' without problem/warning on most compilers, but is fundamentally broken
 
well, that specific code isn't broken at all
 

« first day (474 days earlier)      last day (4467 days later) »