« first day (596 days earlier)      last day (4353 days later) » 

2:01 PM
thinking about it I'm not even sure if the python version from the blog caches correctly..
 
well, if you capture by value, you won't update the map?
 
@bamboon Hmm. Explain. Isn’t the variable only captured once, when creating the lambda, and exists thereafter?
i.e. isn’t capture equivalent to passing an object to a functor’s constructor?
(and all the captured objects are member variables of that functor)
 
why must c++ have so much social stuff, like friendship and captures and classes and what not
 
Maybe Bjarne was a communist.
 
hummm non-intrusive memoziation is more complicated than I thought
 
2:08 PM
@Nils It really shouldn’t be
 
it really should not be
 
It seems spaces are very good password elements when allowed: dl.dropbox.com/u/209/zxcvbn/test/index.html
 
lol
for some reason, "fuckcakes you fuc" gives "centuries", but "fuckcakes you fuck" gives "12 days".
 
dictionary related stuff I guess.
 
@KonradRudolph hmm, yeah you are right. turns out I had a little misunderstanding of the lambda behaviour
 
2:17 PM
damn, memoization is more complicated :(
 
@KonradRudolph How so?
 
@DeadMG Well, if you want to memoize a recursive function then you need to replace the recursive calls with the memoized version
 
yes, I've dealt with that
it's called a Y-combinator and it's not very hard
 
which means that you cannot define this non-intrusively since C++ has no compile-time way (or run-time, for that matter) of walking the AST and modifying it
 
you can even do it with no dynamic allocation or indirection
 
2:19 PM
@DeadMG read further above ;)
@DeadMG I’d be interested to see this, I’ve just tried writing a y combinator and I’ve been horribly unsuccessful, even when using type erasure, since I can’t figure out the argument types of the lambdas
 
watch'n'learn, nub
 
this doesn’t work:
template <typename R, typename A>
function<R(A)> y(function<function<R(A)>(function<R(A)>)> f) {
    auto rec = [=] (function<function<R(A)>(function<R(A)>)> x) -> function<R(A)> {
        return [=] (function<R(A)> v) { return f(x(x))(v); };
    };
    return rec(rec);
}
… and it’s already more complicated than I’d like
 
… and that’s related how?
 
well, it quite clearly y combinates the fact function
 
2:25 PM
well one could argue that the second argument, F&& f is intrusive
 
@DeadMG Not really, that’s not a y combinator
 
@KonradRudolph Quite clearly, since the recursive call is replaced fairly arbitrarily.
@Nils No other way to do it.
 
@DeadMG Irrelevant, that’s not how the y combinator is defined
 
@KonradRudolph Does it do the same job? Yes? It's the same thing.
 
The Y combinator is a specific function which is defined (in lambda calculus) as Y = λf.(λx.f (x x)) (λx.f (x x))
@DeadMG No, and no.
 
2:26 PM
well, fuck lambda calculus
it's a giant pile of unusable, irrelevant, shit
 
i don't understand this urge to everything in lisp
 
come back when you have something that's remotely approximable to real programmin
 
that is functional
just write a function that checks if arguments are in map, if so retrieve result, otherwise call original func and store result, or am i misunderstanding completely?
 
well have you guys looked at the python memoized fibonacci func?
 
oh yes you can't do that
sorry
 
2:28 PM
@DeadMG this statement completely disqualifies you in this discussion
 
memoization needs to be intrusive
 
@KonradRudolph Oh, sorry, I didn't realize that you stored integers as repeated applications of functions in your programs.
and express multiplication and such in their raw boolean equivalents
and other insane shit
 
@DeadMG that’s also irrelevant. I just posted that definition because I had it handy (copied from Wikipedia) and because it’s concise
it has got nothing to do with storing integers as Peano numbers
 
it's irrelevant.
 
2:30 PM
oh it looks incorrect
does not seem to catch recursive calls within the original function
 
@DeadMG Clearly not, it’s the definition of the Y combinator
 
yeah
 
that's why i said memoization needs to be intrusive
 
however it seems to work
 
oterwise need to build up from "lowest level" arguments
 
2:30 PM
if I execute it on my macbook
 
and that needs very intimate knowledge of the original function
 
@KonradRudolph In some random system which has very little to do with actual programs.
 
@DeadMG No
 
@CheersandhthAlf You mean this line, right? result = stored_results[args] = fn(*args)
 
I posted it since your version was actually wrong, because it’s not equivalent to the one I posted
that’s all that matters
 
2:32 PM
@KonradRudolph So why don't you demonstrate the correct version, in the only way that actually matters- real code that real people write
 
@Nils sorry, i was wrong. the fix it later on in article, by storing wrapped function under name of original.
 
@DeadMG Dude, are you blind? I wrote (a) my version, (b) that I can’t get it to work above
 
it's the python mindset where something far away and later affects what you do here
 
@CheersandhthAlf where?
 
works well for simple memorization
fib = memoize(fib)
 
2:33 PM
@KonradRudolph So my version doesn't work (even though I posted a running sample which produces the exactly correct result), but your version is correct even though it doesn't work?
 
@CheersandhthAlf ouh dear..
 
@DeadMG Your “version” has got nothing to do with the Y combinator
 
@CheersandhthAlf thx
 
funny, because I seem to have written a recursive function where the recursion can be replaced with another function, which is exactly what that does
 
it’s equivalent to showing me a program that prints “bananas” when I want a missile guiding system, and insisting that your program is more correct than mine, which is a missile guiding system, albeit one that has a floating point bug
 
2:34 PM
I think @Konrad and @DeadMG need to talk about a different example that exemplifies @Konrad's point.
 
strawberries
 
This whole discussion started from an unclear example.
 
I give up never gonna give you up
 
@KonradRudolph don't
 
@KonradRudolph Except mine already guides a missile, for the specific example I chose to use.
 
2:39 PM
stop meta-discussing!
 
@DeadMG No, it doesn’t. A Y combinator isn’t merely about injecting a function, it’s specifically about defining a recursive function, nothing more and nothing less.
 
@KonradRudolph I did define a mutually recursive function, between fact_doubler and fact.
 
In particular, your “combinator” is everything but a fixpoint
 
@DeadMG nice for you, but that’s not what a Y combinator does / is supposed to do
 
2:40 PM
@KonradRudolph It produces exactly the same output. What more do you want?
 
Today I realized that my life sucked without move semantics.
2
 
@DeadMG Please read up on what a fixpoint is
 
no
 
(also, “exactly same output” compared to what?)
 
ok, by better example I did not mean more terminology @DeadMG does not (want to) understand.
 
2:41 PM
@StackedCrooked Amen.
 
the only examples of fixpoint anything are pointless lambda calculus wanking
 
ouh yeah @StackedCrooked move semantics, that's what will have the biggest impact on your life!
 
I want to know, exactly, what property of a Y-combinator (except the generic part, my example was just an example in one function) that my system does not exhibit
 
@DeadMG No, it’s not. And until you are prepared to correct your misconceptions in that point, the whole discussion is moot
 
no, lambda calculus is moot.
I could program in Brainfuck and it would have more useful properties
 
2:42 PM
It's very satisfying to disable copy construction and copy assignment while allowing move construction and move assignment. And I don't even need to write any special code most of the time. Just a few cases of = default and = delete.
 
common boys
 
@DeadMG Pragmatic nevertheless.
 
@DeadMG You utterly fail to comprehend the relevance / use of lambda calculus
 
@KonradRudolph No processor on my computer or any computer I might wish my programs to execute on accepts lambda calculus; therefore it has neither relevance nor use.
 
you don’t try to build cranes based on algebra, yet I don’t hear you raving about how useless algebra is
 
2:44 PM
It think the bigger challenge would be to explain the relevance.
For most people, at least.
 
@StackedCrooked It’s a notational system that allows reasoning about algorithms. Like algebra. Simple.
 
I can reason about algorithms written in C++ just fine
 
Heyhey, anyone fond of graph theory in here?
 
@DeadMG But as I’ve shown with an example above, it’s much (much!) more complicated when reasoning about combinators
 
What exactly is an "anti transitive graph"? I searched on several internets (the french one and the english one) and found nothing about it. Any clue?
 
2:47 PM
sure everybody loves graph theory :) just quite a while ago until I used graph theory
 
@KonradRudolph You say that, but you have little evidence for it. As I've said, I believe that my Y-combinator works just fine for the specific example.
 
@DeadMG aaargh! Can you please write me one that can define arbitrary recursive function definitions? Then we can talk
as I’ve repeatedly tried to explain to you, it’s irrelevant that you have some specific function. A Y combinator is general-purpose!
 
@KonradRudolph come on we all know @DeadMG's opinion on theory
 
Every theory is silly except DeadMG's theories :)
2
 
@Cicada sorry never read about that
 
2:50 PM
Also, how the hell did my programming folder become like 10 GB
 
@Pubby especially @DeadMG's theories.
 
@Pubby Versioning?
 
@Cicada Context? Perhaps somebody is just anti-“transitive graphs”?
 
Most of my shit doesn't use versioning because I am stupid
 
@Pubby debug libaries? visual studio generated large databases
 
2:51 PM
Probably because I have like 10 different versions of Boost in it
 
@Pubby Funny enough, I use rigorous versioning for all of my stuff … except for my actual work project
 
I would use it more if I could remember how to.
 
Maybe this picture can help.
 
I think I've read Pro Git about 3 times
 
The first graph is transitive (that I understand) the second is anti-transitive, the last is neither
 
2:53 PM
@KonradRudolph It was just an example to give you an idea of how it could be done generically.
I'm currently having fun with the more generic version, because I can't remember what ideone's C++11 feature set is like
 
@DeadMG But the point is, it can’t be done even remotely like this
 
well, have a look at ideone.com/vj4Bx
I think that ideone is barfing on the delayed return type, but I'm not sure
 
you’re still combining two functions here, which isn’t what we want
We just want to define one function recursively without using direct recursion in it
 
yeah, because I chose to introduce another function to alter the behaviour
 
but just replacing doubler by id could be interesting
 
2:56 PM
you could just y_combine(fact, fact) if you wanted to
and if the Committee had included polymorphic lambdas, we wouldn't need the structs :(
or simply overload y_combine so that it returns y_combine(fact, fact).
 
@DeadMG Nah, won’t work, you need to combine(fact, id)
… actually, combine(fact(), id()), btw.
 
uh, I'm pretty sure that y_combine(fact(), fact()) would be exactly correct
 
Is there a library for manipulating Hg repos?
 
but unfortunately this is still not a Y combinator
 
what the fuck property is it supposed to have that it does not?
 
3:00 PM
the problem is that both fact and id refer to themselves (*this), and the whole point of the combinator is to avoid this
 
@RadekdaknokSlupik Guessing, hglib?
 
you can eliminate that if you have some pointless burning desire to
not that I recall the exact mechanism by which I achieved that in the past
 
@DeadMG Well, it’s the whole point of the Y combinator and other fixed-point combinators. Otherwise you don’t need them
 
@Cicada hmm that's a Python library.
 
and yes, that makes them fairly useless in C++, unless you want to define a recursive lambda, which is how we originally started this particular topic
 
3:02 PM
so I have to get some stuff done
bye
 
> Command Server — A server that allows communication with Mercurial's API over a pipe.
This seems to do what I want.
 
which is impossible without polymorphic lambdas, I believe
 
@Nils liar :p it’s Sunday
@DeadMG I fear you may be right
 
What's a good lightweight terminal emulator?
 
of course, for general polymorphic functions, like T::operator(), it's more than doable
 
3:03 PM
XTerm is bothering me.
 
No C++ interface atm
 
oh my god
 
oh your god
 
where do all the stupid people come from?
1
Q: signed/unsigned int mismatch

user974967The following program gives a signed/unsigned mismatch warning: #include <iostream> int main() { unsigned int a = 2; int b = -2; if(a < b) std::cout << "a is less than b!"; return 0; } I'm trying to understand the problem when it comes to mixing signed and unsigned ints. ...

 
@KonradRudolph Stupidville.
 
3:10 PM
@CatPlusPlus , USA.
 
lol
ICE in MSVC
 
Holland :p
 
So, wait, @KonradRudolph, you went and downvoted the whole shit?
@DeadMG There's ice in MSVC?
 
No, Holland is where stoned people come from.
 
Internal Compiler Error
 
3:12 PM
Yeah, I know. I was just trying to make a bad pun.
 
It's easy to ICE it with PCH.
 
@CatPlusPlus You mean they export lapidated people?
 
@EtiennedeMartel No. I only downvoted one answer, the one at –2 currently
but only because I abhor serial downvoting, I actually think the other answers, except the one I upvoted (and commented on) are really bad
 
Still playing with combinators?
 
3:15 PM
GCC still won't bite, but I think it's valid C++11
I said that the code I posted originally showed the basis of how to get it done, and that's entirely true
although of course now doubler is infinitely recursive
/whoops
 
Quick, I need a downvote. I'm at 33335 rep.
 
@DeadMG Compiles for me (GCC 4.7)
lol
 
Who's playing with combinators?
 
@KonradRudolph Yeah, I got the impression from the error message that it was legal but not implemented.
@Potatoswatter I am currently pwning Konrad with them.
 
@Potatoswatter here you go
 
3:18 PM
Awesome. Reimplement recursion in a language which shouldn't have it.
 
@Potatoswatter Why shouldn't C++ have recursion? It's a kinda useful tool
 
@bamboon Thank you sir, may I please not have another
@DeadMG In TMP. Just being flippant.
 
fair enough
 
@CatPlusPlus: is there someone working on an X11 driver for springbok?
 
@Potatoswatter haha no, my tiny rep is not worth it^^
 
3:19 PM
although I seem to recall defining a feature in Wide where you could refer to yourself in an anonymous lambda, making it kinda moot point anyway
 
@bamboon Hey, I never thought of sorting my answers by reverse rep. Thanks a bunch.
 
man, the current XKCD is pretty funny
 
@DeadMG Wow, it even works with lambdas
 
@KonradRudolph Yeah, you can use std::function for that.
 
it’s still not a Y combinator by the way, but it’s another fixed-point combinator, which solves the problem just as well
auto result = y_combine([] (unsigned i, std::function<int(int)>&& f) {
    return i == 0 ? 1 : i * f(i - 1);
});
 
3:26 PM
yeah, unfortunately you have to dynamically allocate to obtain the necessary polymorphism
@KonradRudolph What's the difference?
 
@DeadMG The signature … if it were a Y combinator, then the function definition would use a nested lambda, as follows:
auto result = y_combine([] (std::function<int(int)> f) {
    return [=] (unsigned i) { return i == 0 ? 1 : i * f(i - 1); };
});
 
why would you ever write such a thing
 
@DeadMG To be honest, I don’t know. Maybe it’s because now the inner lambda has the same signature as the resulting function? There may be some mathematical reason to prefer this form.
 
Doesn't the difference between fixed-point combinators lie in their internal expression, not how they're used?
 
yeah, that inner lambda looks suspiciously like y_combinator struct
 
3:30 PM
@Potatoswatter Actually, yes. I’m not even sure if this really is a fixed-point combinator (since it changes the signature) but since it fulfils the purpose …
 
@KonradRudolph All you did here is break a binary function down to nested unary functions using lambda calculus. There's no semantic difference as far as LC is concerned…
 
@Potatoswatter Ah, good
 
the point is
I'm right, as usual
 
I dunno. I would've noticed faster but I'm zonked out… getting through a nasty eye infection.
 
@stackedcrookked @pubby ideone.com/MQr0Z I cant recall how up-to-date it is, and if I recall I was reinterpret-casting a pair<a,b> to a pair<const a, b> (which is UB if I recall).
does std::function use an allocator to work it's witchery?
 
3:34 PM
@MooingDuck Is it? pair is POD/standard-layout if a and b are, right?
@MooingDuck Yes, it performs heap allocations. And it does allow for an allocator argument ot the constructors/assignment.
 
So it has come to this. I'm writing macros..
 
I'm a bit curious regarding TMP and its history, is there some motion to actualize formalize it a little better. It is useful, but because it's more or less an exploit of its turing-completeness, it becomes cumbersome over time. Perhaps take its general uses and expose them more neatly in future standard revisions? Some neat facilities that encapsulate its power?
In context of C++, of course.
 
@potatoeswatter it's a map class, it's not intended to require pod.
@domago so few people need TMP exploits that nobody really cares about making that easier
off to breakfast!
 
@DomagojPandža TMP is ancient history. <type_traits> is the main header used to "encapsulate its power"
 
The C++ committee asking for for more library proposals. And yet there are so many boost libraries. But why are we then still lacking a few very basic ones? Like unicode, xml and gui?
 
3:39 PM
@KillianDS @thecoshman was tinkering with it.
 
Unicode… dammit why did they include those useless codecvt kludges in C++11…
 
I agree on some Unicode love, but GUI... I'm not really sure about that.
 
XML is such a semantic mess and the world seems to be generally moving away from it, at long last.
 
@StackedCrooked A standard GUI would suck.
 
@CatPlusPlus great, I'll talk to him then.
 
3:40 PM
And you can't pick just one of DOM and SAX, you have to implement both.
 
does it have to
 
What we need is JSON support. Because XML sucks.
 
I want process management.
 
Yeah, that would be cool.
 
@CatPlusPlus Yeah, why can't we launch processes in C++? What the hell..
 
3:42 PM
Yeah. Better coverage of POSIX features would be nice. Like filesystem support.
 
Boost.Filesystem is already in proposals.
 
@StackedCrooked In practice, there's system, it's just not defined to do anything in particular.
 
system sucks.
 
Is asio still considered for a following standard/tr?
 
Forces the use of shell, no lifetime management, no I/O.
 
3:43 PM
That's quite sucky indeed.
 
Always blocking.
 
With multithreading, nothing is always blocking. But yes, it does suck. Just saying it fits the bill of launching another process.
 
@CatPlusPlus I don't oppose strongly to that. I could always thread it.
 
What we need is some sort of function that returns a process object that we can use to play with the process.
Such as redirect I/O, get events, etc.
Actually, a bit like System.Diagnostics.Process.
 
Get events? To be reasonable it has to stick to POSIX features.
 
3:45 PM
Process streams!
 
I should check what the possibilities of Poco::Process were again. It wasn't too great in my memory. I remember having to change the source code to prevent a DOS window from popping up when starting a process.
But at least it worked and it was cross-platform.
 
Console window is not DOS. Grr.
 
I used to say console window. But recently I've weakened.
 
Lol, a Windows window then :)
 
Ah, the lovely console.
 
3:47 PM
@LucDanton Hmm, I think you're right. Thanks.
 
I hate IBM because they introduced the backslash in path names.
 
@StackedCrooked That would be CP/M, no?
 
Ok, maybe they didn't introduce it. But still.
@Potatoswatter Yeah, could be.
 
Console window sucks so much.
 
IBM could have changed it in the early days.
 
3:48 PM
Yeah, now everyone is confused about which slash is which.
 
Windows supports /, I think.
 
Windows supports both.
 
So you could juste use / everywhere and be on your way.
 
/ is so much better
 
/ is the superior.
 
3:49 PM
Well, don't use / in filenames. But feel free to use , which is slightly tiltier.
 
Except some tools will get confused.
 
I've always felt that its "direction" shows the flow of the path.
 
@CatPlusPlus Those tools are crap.
 
@CatPlusPlus IIRC, WinAPI doesn't
 
Backslash is an escape character. It's the worst possible choice for a path separator.
 
3:50 PM
@EtiennedeMartel Those tools use / as switch introducer.
Which is the reason why \ exists at all.
@StackedCrooked PHP uses it as a namespace separator. xD
 
- or -- is fine as switch introducer
if you have a program so primitive you need a CLI, anyway
 
Yes, but CP/M didn't do that.
 
@CatPlusPlus What? I don't even..
 
lol, that thing uses the words "PHP" and "rationale", and it's not to say "There's no rationale for PHP".
 
3:53 PM
They had a meeting on IRC and somehow arrived at "\ is the best choice for a namespace separator"
 
Bad design choices often had a rational. Albeit a short-sighted one.
Cool Poco now has a TextIterator. It allows to iterate over unicode characters.
Does std::vector impose any overhead compared to manually managed dynamic allocated arrays? The only thing I can think of is that it may take a little more space on the stack. Anything else?
 
@CatPlusPlus What the fuck.
 

« first day (596 days earlier)      last day (4353 days later) »