« first day (1257 days earlier)      last day (3917 days later) » 

user1804599
23:01
Should it be possible to use std::get on e.g. vectors and arrays?
user1804599
Why not?
why would you?
user1804599
Dunno.
user1804599
Sufficiently generic code. :P
23:03
doesn't std::get require constexpr indexing?
user1804599
What do you mean?
user1804599
You do not have to pass a constexpr tuple.
that the argument that identifies the index of the element you want to get must be a constexpr
user1804599
Yes, it has to be an ICE.
then it doesn't make much sense for vectors to begin with
user1804599
23:04
vOv
@Jefffrey Maybe for benefits of generic code in some extreme cases.
You could make an overload for arrays, but std::get is not supposed to be used with containers. In fact, no containers have the std::get overload.
user1804599
Writing C++ is always an extreme case.
@EvgenyPanasyuk see below
lol, nevermind
@Jefffrey Yes, other containers don't have. But we are talking in general, not about current state of ISO.
23:07
@EvgenyPanasyuk actually, some containers do
(std::array)
> Java is neither a good nor a bad language. It is a mediocre language, and there is no struggle. In Haskell or even in Perl you are always worrying about whether you are doing something in the cleanest and the best way. In Java, you can forget about doing it in the cleanest or the best way, because that is impossible lol
9
Spot on. Except that the title is "Why I like Java"/"I really like Java".
@sehe totally spot on
I remember reading that article, enjoyed it.
@rightfold, as I said, for arrays it makes sense, for vectors it doesn't
> The project might fail, but if it does you can probably put the blame somewhere else. After all, you produced 576 classes that contain 10,000 lines of Java code, all of it seemingly essential, so you were doing your job.
> But it has happened more than once that when I look at the candidate's incomplete submissions I see that the problem, at least this time, is not necessarily in the testing system. There is another possible problem that had not even occurred to me. The candidate failed the trivial question because they tried to write the answer in Java.
It really has some nice quotes
23:11
Yeah, well written and spot on.
Since I'm indeed doing Java at work too, I can relate to the "relaxing" qualities of the language. But I hate that.
user1804599
If I have to write T x = new T(); it is already too terrible for me to even consider doing it.
user1804599
var x = new T(); pl0x.
user1804599
class var { } class T extends var { } :V
Xeo
Xeo
meh, already time to sleep again.
kinda missing my free time from being sick
OTOH, not missing the pain that has gotten substantially less
23:21
There's something I don't understand about Haskell
and I'm probably missing the point of it too
but won't you, at some point, need to store some data in your program that you'll need to be able to modify?
you can compute and return a new immutable instance of such data
Or use state monad (or something like that).
f x = 1 + x
f 5 will give you 6
take for example the player position in a game, you do IO and need to update the position
modified enough
:)
23:23
@ScarletAmaranth lol
I would of course do succ
or (+1) or whatever, was an example :)
@ScarletAmaranth f = succ
;)
"so good"
Xeo
Xeo
@Jefffrey do you actually need to modify stuff, or the appearance that something has been modified? :)
I know that's an hint, lemme think a sec
Xeo
Xeo
23:24
@Jefffrey Can be done with State (aka pure 'mutation')
or with unsafe perform IO compiler magic :)
Debug.Trace.trace ^^
@Jefffrey Imagine that you have game_state value, and function next_state, which can be used as game_state3 = next_state(next_state(game_state1)). There is some syntax sugar around it called monads + do syntax.
Xeo
Xeo
since a Haskell programm is basically a looong list of expressions, modifications from earlier expressions can easily affect later expressions, as is the example with State.
IO is similar, but just a bit special and magical
-1
Q: How do you determine the running time complexity for these problems?

user3466314I need to determine the running time for each program. constTimeFunction(n): T(n) = O(1) linTimeFunction(n): T(n) = O(n) quadTimeFunction(n): T(n) = O(n2) cubeTimeFunction(n): T(n) = O(n3) I've provided my answers. Am I wrong? Program 1: for (i=0; i<4*n; ++i) { linTimeFunction( n );...

^^ If I wanted to be really mean, I could say that it's undecidable because it's the halting problem. :)
@Mysticial do eet
Xeo
Xeo
23:27
also, in the worst worst case, you can always fall back to a C FFI :D
@Xeo nope.jpg
@Xeo nothx :P
so, I should start from here?
@Jefffrey no
Xeo
Xeo
23:30
write a tic-tac-toe!
Why do monads have 1 million pages dedicated to it?
@EvgenyPanasyuk well, I have already read that book
a month ago
Xeo
Xeo
@Rapptz because people make them out to be special
@Rapptz For the same reason people get their panties wet about ranges? idk =/
Xeo
Xeo
23:32
and everyone wants to explain something special
@Xeo while we all know that only arrows are special
Xeo
Xeo
not really
import Control.Arrow
is the equivalent of
ksibsjkui arrows?
Xeo
Xeo
monads are values with context, arrows are functions with context :D
23:32
import Control.Magic
@Jefffrey Then just read other introductions to monads. When I studied them - I read multiple sources simultaneously.
(I don't remember the name)
I think there's a type. "Hammer" was misspelled there. — sehe 4 secs ago
^ I'm bad (at typing "typo" too, apparently)
Xeo
Xeo
@ScarletAmaranth Definitly no. Nothing in Control.Arrow is 'magic'. There are only two instances by default, both of which are naturally trivial
@sehe Hahah :P
23:34
arrows behave in a mysterious way and I have never managed to apply them properly
:)
Xeo
Xeo
@sehe all the time
@ScarletAmaranth you can use normal functions like arrows
> m_timerThread = boost::shared_ptr<boost::thread>(new boost::thread(boost::bind(&boost::asio::io_service::run
wow
and I have never really seen a good arrow example
Xeo
Xeo
(+4) &&& (*10) $ 5 -> (9, 50)
people talk about how to compose arrows rather than bothering to explain what arrows do
right, so you do application on 5 for both +4 and *10
Xeo
Xeo
23:35
@ScarletAmaranth arrows are functions. and then some.
pretty much everything is a function in haskell IIRC
this looks like a combinator that grabs application ($) and an extra arg (5) and distributes them to (\x -> x + 4) and (\x -> x * 10) to me
even type constructors
Xeo
Xeo
@ScarletAmaranth ya. there's also actually an Applicative way to write that: (,) <$> (+5) <*> (*10)
@Xeo operator ratio too high, aborting
Xeo
Xeo
23:37
@ScarletAmaranth f &&& g = \x -> (f x, g x)
for (->)
@ScarletAmaranth also, it doesn't "grab" application
I only used $ to have 5 be passed to the whole expression
right, it's a binary op, nevermind me
mmm, so
&&& looks like it distributes an argument to f and g
Xeo
Xeo
> let f = (+4) &&& (*10)
> f 5
(9,50)
and how does it combine the results?
with (,)?
@Xeo theres an operator to create a tuple of the result of the application of two functions on the same input?
wow...
@Borgleader it's just a function that takes 2 elements and returns a tuple of them o_O how is that surprising?
(,) a b = (a, b)
Xeo
Xeo
23:41
@ScarletAmaranth (&&&) :: (a -> b) -> (a -> c) -> a -> (b, c), so yes
ok, that's simple enough so far, keep going, @Xeo ^^
@ScarletAmaranth not that one, &&& or did i misunderstand what it does?
Xeo
Xeo
@Borgleader It follows naturally from some the theory behind Arrows
@Borgleader nope, correct
4 mins ago, by Xeo
@ScarletAmaranth f &&& g = \x -> (f x, g x)
@Xeo I guess I don't know haskell enough for it to make sense that this should be a commonly used operator =/
Xeo
Xeo
(note that all examples are specialized to (->), aka the plain-old function arrow)
@Borgleader it's not that common
23:43
it's magical
Xeo
Xeo
unless you're writing Arrow code
you need to comment what school of magic you use whenever you use it
Xeo
Xeo
then it becomes rather common indeed
-- Divination --
{- use arrows here -}
(other options include but are not limited to: Necromancy, Illusion, Abjuration)
Xeo
Xeo
{-# LANGUAGE Arrows #-} :)
oh shit, almost 1am
23:44
Xeo
what do I read about arrows
Xeo
Xeo
uuh
dunno, I read a bunch of stuff
there are two fundamental arrow papers, but they quickly 'digress' into circuit logic (which is also an application of arrows), which I found rather annoying
Circuit logic?
like, (&&&) and (***) and I'm like: whaaat
Xeo
Xeo
@ScarletAmaranth (***) :: (a -> c) -> (b -> d) -> (a, b) -> (c, d)
yeah, it's a form of "distribution" again
but I am clearly missing the big picture
23:48
the big picture is, that should be a named function and not a silly operator ;)
it doesn't matter
Xeo
Xeo
@ScarletAmaranth @R.MartinhoFernandes linked me an interesting paper on the idea behind arrows, which was a fun read, but dunno if that's a good idea for you :)
look ma, function
Xeo
Xeo
@Borgleader Actually, the operators make quite some sense
(***) a b
Xeo
Xeo
23:49
* is product, and a tuple is a product in type algebra
@Xeo ehh, just link it to me? facepalm
@Xeo o.o I have a hard time believing that, but then again, I'm stupid.
Xeo
Xeo
@ScarletAmaranth don't have the link around anymore, sorry :D
+ is sum, and Either is the sum type in type algebra
@R.MartinhoFernandes feel encouraged to link that interesting arrow article :)
Xeo
Xeo
That's where (***) and (+++) come from
(&&&) is conjunction (get output from both functions) , (|||) disjunction (pipe input through one of the two, depending on its tag)
Arrow and ArrowChoice operators have an interesting relationship at the type level
> most of C++'s "power" is just opportunities for awful coding practices. C++ is actually powerful and sometimes necessary, but it is also completely wrong in a lot of things. You either have to restrict yourself to a small subset of the language (because honestly no human brain can grasp the whole of C++) or write completely unreadable, heterogenous code.
@Rapptz amateur league of extraordinary video game developers again?
but of course
Xeo
Xeo
(***) :: (a -> c) -> (b -> d) -> (a, b) -> (c, d)
(+++) :: (a -> c) -> (b -> d) -> Either a b -> Either c d
(&&&) :: (a -> b) -> (a -> c) -> a -> (b, c)
(|||) :: (a -> c) -> (b -> c) -> Either a b -> c
just some thought food
sleep now
@Jefffrey really useless use of sharedptr there

« first day (1257 days earlier)      last day (3917 days later) »