« first day (1209 days earlier)      last day (3738 days later) » 

SAM
6:00 AM
I also want to learn Haskell. Any suggestions?
 
Read Real World Haskell
Or Learn You a Haskell if you like pictures and the occasional condescending remark
 
Learn You a Haskell is great
 
@SAM RWH
 
SAM
@Rapptz @Code-Guru @Borgleader Thanks.. mates!!!
@Rapptz Yup I like pictures too.. :)
I'll buy both of the books today...
 
both are free online
 
SAM
6:09 AM
I have heard that it's functional paradigm and makes you think in a lot different way than traditional procedural thinking...
 
very
 
SAM
@Rapptz Ok..
 
iunno
I feel the same, makes me feel like I learned wrong
 
SAM
Wut?
 
I didn't get some revelation while learning
 
SAM
6:11 AM
=> You were clever from since before :)
 
I don't know about any revelations, but it definitely takes a lot to wrap my head around even moderately advanced Haskell.
I find RWH much harder to read than LYAH
 
I don't know if that's supposed to signify difference in thinking as a programmer in whole or just hard to grok a language
 
more of the second...at least for me
 
SAM
Does it have any relation with lisp? hmm.. since I have seen and understood some "cute little" snippets of lisp
 
both are functional
 
6:13 AM
tbh I always thought it was the latter, I kind of find Haskell's syntax a bit silly which sucks because I like math and mathematical writing
 
beyond that caterozation, not really
any particular part of the syntax or just in general?
 
Operator abuse specifically
 
Is it just me, or is everyone getting the mobile layout?
Nah… only Safari.
 
SAM
When I learned those "cute little" snippets of lisp, I was better at recursive functions...
 
true, Haskell is crazy about inventing new operators
 
6:17 AM
Maybe there's a functional programming language with better syntax :P
 
F#?
 
It's not really a pure functional language
 
lisp syntax is definitely simple
 
SAM
better syntax... like?
 
user3010322
@Code-Guru How do you indicate an infinitely repeating pattern in the language set L?
 
SAM
6:19 AM
@Code-Guru except for the last closing parentheses :p
 
@ThePhD L+ (I think?)
 
@ThePhD in a DFA or a regex?
 
user3010322
I have broken down a transition table to be the strings that go from 0 to 1 to 0 to 1 to 0, and any other states become invalid, so it's like L = { 0, 1, 0, 1, ..., 0, 1, ... }. It's a DFA.
 
p1 --0--> p2 --1--> p1
it's a loop, which I can't draw very well with linear ascii art
 
user3010322
Yeah
 
user3010322
6:21 AM
I need to write the language construct, though
 
user3010322
Like, what I would stick in the L = { ... }
 
oh, the transition function?
hrmm...I think I'd write L=(01)*
 
SAM
Look at this:
stackoverflow.com/questions/234075/what-is-your-best-programmer-joke#answer-235790
 
user3010322
The language's definition. I have all the states (Q = { q0, q1, q2, q3 }), all the alphabet (E = { 0, 1 })
 
user3010322
@Code-Guru Ah. Well, okay.
 
6:23 AM
@ThePhD initial state, final state? :)
 
user3010322
@melak47 Start state is q0, which is empty set Epsilon
 
user3010322
Final State is accepting state, which was described in transition table as loop after 01 back to 0, to 1 again, then repeat.
 
user3010322
So accepting state is 01
 
user3010322
With chance to loop back and do it all over again
 
are you allowed to give the transition function as a graph?
 
user3010322
6:24 AM
Uh
 
or what are you supposed to do
 
user3010322
I don't think we've covered that. :D
 
graph == a drawing
 
user3010322
I just need the syntax for the Language part, the L = { }
 
I think you have everything except the transition function
 
6:25 AM
IMO L = {(01)*} is sufficient
 
not if he's supposed to give the full language tuple
 
for the part he's asking about
 
and these classes are usually anal about formalism :)
 
he's got the rest of the tuple already, afaict
 
oh, just the language, yeah
 
SAM
6:28 AM
@Rapptz @Code-Guru @Borgleader Does Lambdas in C++11(or in C++14) have anything to do with functional paradigm?
 
yes
lambda functions are a formalism that come straight out of functional programming
 
Sure
 
or maybe the other way around...chicken and egg?
the C++ version is an attempt to put some functional programming stuff into the lang
 
SAM
Hmm... that means C++ has a little support for functional paradigm as well?
 
user3010322
Oh noooooooo!!
 
user3010322
6:36 AM
There's... THERE'S A PROOF
 
user3010322
I thought I almost made it out! Of course they'd put a proof for the last problem.
 
user3010322
I fucking hate proofs.
 
:D
 
user3010322
u.u Don't you smile at me!
 
user3010322
You're just enjoying my misery.
 
6:46 AM
what are you proving?
 
Let me guess...you have to use the pumping lemma?
"Prove that ... is a Regular Language"
 
Pumping Lemma!
 
well, I'm out for tonight
time to go home and go to bed
@ThePhD Good luck with that proof!
 
user3010322
;~;
 
user3010322
Don't leave me!
 
SAM
6:56 AM
@Code-Guru Bye bye... see you later...
 
user3010322
@Code-Guru Sleep well. :c
 
user3010322
Given:
Deterministic Finite Automata A,
E = { 0, 1 },
Q = { q0, q1, q2 }
 
user3010322
deltaHat =
      0   1
 -> q0 q1 q2
    q1 q1 q1
    q2 q1 q2
 
user3010322
I have to prove that this results in a language L = { [1]+ }
 
user3010322
I've gotten as far as boiling down deltaHat to point to some state qX, where X is 1 (and thus q1) if there's a 0 in the input string s
 
user3010322
6:59 AM
But I need to boil it down even more to get at the base case of the deltaHat and define it in terms of a single-state-returning delta.
 
morning guys
 
user3010322
Bloody morning. ._.
 
user3010322
Flight is in 12 hours. If I stay up too long I'll miss it.
 
SAM
@thecoshman Morning!
@ThePhD Happy journey!
OK guys... time to go.... see you guys later.....
 
7:19 AM
9
Q: Most efficient pointer arithmetic type in c

makhlaghiI assume that an internal casting happens when we write: arr[i] (which is equivalent to *(arr+i)). Because i can for example be a short, int or long or the unsigned variant of any of these three. So my question is simple: which type should i be so that no internal conversion takes place? So tha...

^^ I'm quite surprised that nobody has flamed the OP for premature optimization yet.
 
@Mysticial I recall a talk by Alexandrescu where he mentioned that array indexing can be faster than pointer arithmetic.
 
@StackedCrooked Depends on the compiler. Array indexing can be vectorized. Pointer arithmetic can only be vectorized if the compiler is able to convert it into array indexing.
I think. I'm not 100% sure though.
 
user3010322
Woo!
 
user3010322
I finished the proof!
 
user3010322
I did a pretty badass job, if I do say so myself.
 
7:26 AM
@Mysticial Ohhh, that explains why my particle thing slowed down. I used a tutorial as a base, and I replace array indexing with iterators and it slowed down a lot
 
@Borgleader hm..
 
user3010322
Iterators are also wrapped in debug versions, where as indexing into a pointer usually isn't unless you're going through a class.
 
user3010322
So, there's that too.
 
@ThePhD I was talking about a Release built obv
 
And Visual Studio requires a special flag to disable debug/checked iterators. (Even in Release mode.)
 
user3010322
7:27 AM
WERE YOU?!
 
Xeo
@StackedCrooked no, not anymore
 
Ah, ok then.
Last VS is used was VS 2008.
 
Xeo
_ITERATOR_DEBUG_LEVEL is 0 by default in release mode, and 2 in debug mode
 
@StackedCrooked wtf? the fact that was ever a thing is just a joke right?
 
Why would it be a joke?
The performance impact only mattered once for me.
That was when I was experimenting with Tetris AI and my node class used std::set for storing its child nodes.
And a huge trees were growing and dying all the time.
 
7:35 AM
huge trees trees?
 
erm..
fixed :)
 
Xeo
0
Q: Lambda function variables in C++11

SquallThere are two ways to use lambda function variable: std::function<int(int, int)> x1 = [=](int a, int b) -> int{return a + b;}; //usage void set(std::function<int(int, int)> x); std::function<int(int, int)> get(); And: std::function<int(int, int)>* x2 = new std::function<int(int, int)>([=](in...

oh gawd that question...
oh gaaaaaawd
 
@StackedCrooked because you set it to release mode, aka I have tested this and now just want to remove all bloat and slow down, and it overrides you and leaves in some bloat and slowdown.
 
meta::in<Needle, Haystack> or meta::is_in<Needle, Haystack>?
 
7:48 AM
is_in
 
Is there anything to hold against things like std::function<Sig> that implements a const call op even though they might call a non-const functor?
 
user3010322
is_in
 
Because you could have something like my_wrapper<R(A, B, C) const> but that seems somewhat arcane…
Eh, I’ll give it a try.
 
Xeo
@LucDanton contains?
 
oo, good option
 
Xeo
8:04 AM
@LucDanton I was wondering about that, since that way you lose the ability to enforce logical constness on the functor
 
It’s not something that feels right at all :|
 
Xeo
I'd probably rather overload op() and as_const the functor in the const version
 
Worst of both words. Now you require models to implement both operations.
Sorry, when I said ‘like std::function<Sig>’ I meant the type-erasing business.
 
Xeo
@LucDanton the non-const version can still call const op() on the functor, or what do you mean?
 
For (non erasing) call wrappers I have a CRTP thing. Named perfect_functor in fact.
 
8:23 AM
morning
I sneezed so hard I almost fell off my chair
 
mooning
 
user1804599
@TonyTheLion You either have a really weird chair or you sit on it in a really weird way.
 
@rightfold No I just sneezed so hard
"sneezed" or "snoze" ???
 
user1804599
“acted weirdly”
 
8:29 AM
lol
 
user1804599
Listening to Celldweller songs in a different order is weird.
 
Never heard of them
I'm listening to Primal Fear.
 
user1804599
Perl’s wantarray is funny.
 
user1804599
> This function should have been named wantlist() instead.
 
user1804599
dat documentation
 
8:39 AM
Heh. It seems that Haskell has the nicest syntax of all functional programming languages that have some form of popularity. Maybe it's familiarity bias.
 
user1804599
I like the syntax of Clojure better.
 
user1804599
inb4 Clojure is not functional because it is impure.
 
I think that all ML or ML-likes can look okay but that practitioners go out of their way to make it ugly.
 
Disgusting parentheses syntax.
 
And I don’t think that Haskellers entirely escape that rule, either.
Schemes are okay in my book, too.
 
8:42 AM
@TonyTheLion exploded nasally
 
To be honest none of these languages have particularly nice syntax :/
 
How is that different from C++
 
@Purrformance you get to toot a functional horn
 
My code has a for loop but it doesn't loop through all iterations, for some odd reason??!! My iteration variable is also not increasing. Meh, sounds like I have UB somewhere.
 
@thecoshman Parse error
@TonyTheLion Is that an if loop by chance?
 
8:45 AM
he he he
 
@TonyTheLion My hypothesis is that your code has a bug.
 
Xeo
@TonyTheLion Celldweller is a single person
 
the beard guy?
 
@StackedCrooked I think you are correct in this hypothesis
@Xeo Thanks for the info
 
user1804599
@TonyTheLion SSCCE or GTFO.
 
8:48 AM
I think for loops are a bad concept.
2
 
they are great
 
The only reason we think of them as normal is because they are the first thing we learn.
 
I learned for loops via math.
 
What would you use instead for iterating stuff?
 
e.g. \sum_{i=1}^10 would be for(int i = 1; i <= 10; ++i)
 
8:51 AM
range-based loop for containers
repeat (n) {} for counted loops
or something like that
or n.times {}
 
loops are a bad concept. Let's replace them with loops.
 
Xeo
@TonyTheLion probably his most famous song (or at least one of my favorites): youtube.com/watch?v=g2eHh4GcJMQ
oops, bad link. sec
 
@Xeo dat song
 
user1804599
@TonyTheLion a quantum computer.
 
Xeo
yeah copy didn't want to copy
 
8:52 AM
happens to me a lot more often than I could count
 
A for loop is like a little program that have to rewrite every time.
It's so silly.
 
Xeo
I normally use ctrl-x on links to see if it actually copied
 
user1804599
@TonyTheLion What programming language?
 
user1804599
In C# you can use LINQ instead of for loops. :P
 
In C# you must use LINQ.
 
8:54 AM
@Xeo hmmm not bad
 
user1804599
In C++ many explicit loops can be replaced by calls to functions in <algorithm>.
 
@rightfold C++
 
user1804599
@Xeo I like So Long Sentiment.
 
Fuck, I can’t define a member generically when it comes to the *this-qualifiers, can I?
 
user1804599
> The halting problem exists. Therefore, let's write shitty software.
 
8:56 AM
Defining members generically?
@rightfold Ready. Set. Go!
 
user1804599
template<typename T> void generic_member();!
 
@LucDanton Maybe in C++20
 
Let’s SFINAE my way out of this ._.
 
I was thinking of a way to circumvent that a while back and came up with nothing
I think the const contextual keyword is one of those C++ Blunders
 
template<typename D = void, EnableIf<is_const<meta::DependOn<self, D>>>...>
R operator()(Args... args) const;
Maybe not so bad. Let’s forget about volatile though.
 
9:01 AM
how'd you get self to compile?
 
@Rapptz I don’t understand.
 
error: invalid use of 'this' at top level

     using self = decltype(*this);

                            ^
what's self?
 
guise
I had a lucid dream
jesus fucking christ
 
It makes sense in context.
 
the only way I've ever gotten away with decltype(*this) is through auto f() -> decltype(*this)
 
Xeo
9:03 AM
@Rapptz that'd be wrong anyways (T&)
 
we don't have to worry about death guys
we are just dreaming
even now
dreams are spectacularly equal to reality
I was able to listen to a whole song I've never listened in months (a very bad quality version of Along the Watchtower) inside my dream. It was exactly the same.
 
Fuck C++.
The horror.
 
And it's not possible I've listened to it during my sleep.
 
I need a breakfast.
 
Going now. I just wanted to share this with you.
 
9:08 AM
@Jefffrey maybe you're a Cylon.
7
 
@Jefffrey any good?
 
@thecoshman awesome
full of symbolism
it gave me insight on some problems I've been struggling in this last year (psychological problems, existential problems)
I feel so good now.
 
> game
 
user1804599
Python y u no string interpolation.
 
@rightfold ("a" + "b") / 2 -- there, interpolated!
 
9:15 AM
And I'm listening to that song I've listened in the dream.
 
@rightfold ?
 
user1804599
@Rapptz "Hello, $name!" like in Perl, PHP and Scala and a shitton of other programming languages.
 
@Jefffrey Yeah, definitely a Cylon...
 
which is exactly this version (sorry for the girl)
 
what's wrong with "Hello, {0}!".format(name)
 
9:16 AM
@TheForestAndtheTrees We all are!
 
user1804599
@Rapptz Verbose and long.
 
user1804599
And fugly.
 
@rightfold "Long"? What.
 
But it exists
 
user1804599
And it is terrible.
 
9:20 AM
I think it's cool
"Hello, {0.x}".format(vector) works
 
Xeo
I'm slowly running out of everyday things to do with this leg. That shower just now was not-nice.
meh, appointment in 2h
 
@TheForestAndtheTrees The capitalization of "and" in your nick disturbs me.
 
user1804599
@Rapptz Gimme "Hello, #{vector.x}".
 
@Griwes hah I hadn't noticed I'd done that.
 
Okay, git, this is a bit iffy indeed:
#       new file:   src/web/rest/http_request.cpp
#       renamed:    src/web/rest/webclient.hpp -> src/web/rest/http_request.hpp
#       new file:   src/web/rest/rest_exception.hpp
#       modified:   src/web/rest/webclient.cpp
#       modified:   src/web/rest/webclient.hpp
 
9:29 AM
>>> class Vector():
...     x = 10
...
>>> test = Vector()
>>> "hello {test.x}".format(**locals())
'hello 10'
 
I know you're supposed to be a "stupid content tracker", but both moving and modifying the same file under the original name is confusing to everyone
 
CRTP can "emulate" virtual methods. It's funny because emulation usually means slower code.
 
> "slowly running"
dat choice of words
 
@Purrformance "a" -- there, interpolated with a very strong bias!
 
@StackedCrooked But then it's just static polymorphism where the 'strategy' or 'policy' happens to be implemented by a derived type, but there is no direct reason for that type to be derived for the emulation to work
 
9:33 AM
@StackedCrooked Well, it is slower. It just takes that hit at compile-time rather than run time :p
 
@sehe The static downcast does imply inheritance.
 
@jalf I don't think that's true
@StackedCrooked ah of course. The instance isn't being passed
 
@sehe Interesting point. Is a class template inherently slower than a normal class?
I wish I had a basic understanding of the compilation process.
 
@StackedCrooked not at all. However, a class with virtual members is inherently slower than one without
 
Most of my includes could be avoided if I could forward declare a type and its methods.
 
9:40 AM
@sehe I'm pretty sure that it takes longer at compile-time to instantiate a template than it does at runtime to follow a single pointer indirection
 
@jalf I suppose a C++ jitter would be horrible :p
 
user1804599
@jalf you run the program more often than you compile it.
 
user1804599
Usually.
 
@rightfold I think he realizes that.
 
@rightfold sure, but I was talking about a single execution. A single compile of a CRTP class vs a single runtime call of a virtual function
 
9:42 AM
@EtiennedeMartel, this song is getting a lot of love here in Italy, do you know them? (french)
 
I'm just pointing out that there is a cost associated with CRTP. It's just incurred while compiling, rather than when executing the code
 
@sehe but isn't that slowness only very slight?
@jalf well of course there is a tradeoff.
 
@thecoshman depends on what you're comparing against. It might be completely unnoticeable, or it might be a complete dealbreaker
 
@thecoshman cost is always relative
 
@jalf let's... measure that. In general yes. But creating the administrative overhead for vtables and checking those costs something too.
 
9:44 AM
@sehe Not necessarily true. If the compiler can determine which function to call, it can devirtualize the call
 
Xeo
Hm. Any of the Japanese learners in here ever heard of 'Japanese from Zero'?
 
oh yes, well obviously that slowness might not be a concern. For most cases though, it's not really a problem is it.
 
@jalf ... But construction is necessarily an extra step :)
 
Construction of what?
 
Yes, the construction of the what.
@sehe you mean the heap allocation?
 
9:47 AM
@sehe In instantiating the CRTP template, the compiler has to call several virtual functions (or similar constructs). Yes, it is slower.
 
As it happens, I actually sort of did measure it last night. I was playing around with Clang and timing how long it took to compile code with some silly recursive templates. And compile-time definitely went up by much more than a couple of nanoseconds for each template instantiation
It's more in the millisecond range
 
@scottw this looks like your dog
 
How recursive?
 
user1804599
TMP JIT.
 
9:54 AM
@Rapptz Just a template <size_t N> class C defining an enum value as C<N-1>::val with a specialization for N==0 ending the recursion
Instantiated with N=255
Pretty trivial and pointless, I was just curious about how long it'd take to compile :p
(the answer is 10-15 seconds, btw)
 
0.4s here
 
gcc
 
But clang is super fast!
 
@R.MartinhoFernandes Well, this with my own custom build of clang. Should be optimized, but still had assertions enabled I think
 
Xeo
9:57 AM
build flags?
 
10-15s feels... really high o.o
 
@Rapptz Yep
 
A profiler tool for the compilation process would be so nice.
 
can't repro though
@Xeo "g++ -O3 -static -Wall -Wextra -pedantic -std=c++11"
 
@Rapptz you can adopt
@Rapptz What does -static do?
 
9:59 AM
statically link libraries
I have it on by default lol
 
@Rapptz Yeah, I dunno what was up with it. I could have just tried the same with the standard clang i get from xcode, but tbh the time it took didn't really concern me. I just wanted to grab a few stacktraces while it was running, so it suited me fine that it took so long :p
 

« first day (1209 days earlier)      last day (3738 days later) »