« first day (2175 days earlier)      last day (2770 days later) » 

11:00 AM
I can't get the hang of how to just fucking return stuff.
Or how to nest functions.
Where the fuck does one thing start and one thing end, I'll never know.
What's the difference between ;; and in { STUFF }
And because all of this bullshit is like
chained and shit
I can't just insert debugging print statements in places
without fundamentally changing the return value and other crap
 
Welcome to FUNCTIONCOIN
 
@ThePhD Whatchya working on?
 
future of progrmaming
 
@ThePhD dude
first of, you surely can
OCaml is much less strict than Haskell when it comes to IO
and even Haskell has trace specifically for that
 
OCaml is nice
 
11:05 AM
and secondly, the fact that it's chained makes it extremely easy to debug, because every part of it can be tested separately
you don't get a state-checking debugger because there's no state to check
@ThePhD and as for that, you're not really supposed to when it comes to execution.
 
Ven
Ocaml's ;; / rules for nesting are kinda bull-shitting
 
I don't know those so I can't say anything
> In revised syntax, simple semicolons end the items of structures, signatures and objects
seems like the revised syntax gets rid of those?
 
the trait `rustc_serialize::Encodable` cannot be made into an object [E0038]
src/lib.rs:74             let fields: [&Encodable] = [
                                      ^~~~~~~~~~~~
src/lib.rs:74:25: 74:37 help: run `rustc --explain E0038` to see a detailed explanation
src/lib.rs:74:25: 74:37 note: method `encode` has generic type parameters
Shit, virtual templates strike again.
 
Ven
who cares about the revised syntax
 
@R.MartinhoFernandes no free lunch allowed!
 
Ven
11:11 AM
no one uses that
 
I need serious type erasure.
RAW POINTERS
writes C++ in Rust
 
that's the spirit
 
Actually, can't erase this properly in C++ either.
Damn virtual templates.
 
like I said
 
Need to bound the parameter space.
 
11:13 AM
At CppCon Chandler mentioned he watched Richard Smith struggle with writing something simple in Rust and needing to fight with the language...
 
@Griwes This is not simple.
 
Ven
That's because he's bad.
 
inb4 C is better because it allows you to do everything
 
Ven
A language's power comes both from what it allows you to do, and from what it allows you to prevent.
8
 
@BartekBanachewicz Richard is apparently fluent in Haskell, m8.
 
11:14 AM
I need to type-erase types with a template function.
 
@Griwes most of my writing in Haskell was hitting it with a hammer
 
Ven
being fluent in Haskell doesn't help become a Rust expert
 
@ThePhD what are the real benefits of that dreadful language? was it designed with a purpose in mind or just because?
 
except that in C things are made of clay and a hammer works. Haskell's structure is made out of unobtanium
 
11:15 AM
@iksemyonov It's meant to be an entirely serious, Industrial Strengthâ„¢ Language.
 
@iksemyonov why do you think it's dreadful?
 
@ThePhD see maybe i'm naive but what can't be done with C++, a couple light interpreted langs like Lua and maybe a few more specialsed like Erlang (though the latter is questionable too)?
 
@Ven Being fluent in Haskell proves you can actually write code in a language that restricts you quite a lot though.
 
@Ven if that's not a quote, it's really smart.
 
Anyway, Rust these days doesn't really make me struggle much. Most of the annoyances I had in this project are related to crossing ABI boundaries with messy structures.
 
11:16 AM
@Griwes in different ways vOv
 
@BartekBanachewicz Doesn't matter.
 
@BartekBanachewicz it's a pun on Phd, but seriously, that's the impression i get being here
 
@iksemyonov Don't treat his opinions as facts, though.
 
Ven
@BartekBanachewicz I don't remember getting it from somewhere
@Griwes very different restrictions. breadth vs depth
 
@iksemyonov See what Ven wrote (starred). "Everything" can be done in assembly.
 
Ven
11:17 AM
@iksemyonov Opposite question: why would you decide to inflict the pain of C++ upon yourself?
 
@BartekBanachewicz i take it half seriously
@Ven what are the alterrnatives?
 
Ven
@iksemyonov thousands of languages?
what's the alternative to do what?
 
Ooooh, I can hack this with a macro.
 
i mean, such an alternative where you can actually make a loop, return a value, and so on, without breaking your fingers
 
@iksemyonov if you only have a hammer, you'll see nails everywhere
 
11:18 AM
I don't actually need to erase the types if I can cut the boilerplate in a different way.
 
I don't need loops to write programs
 
Ven
that doesn't make sense
 
@Ven to do.. well, good question
 
Ven
That's a X-Y problem
 
11:18 AM
hm
 
@iksemyonov err...
 
Ven
"I have a C++ program I want to write, which language is best suited for that?"
6
 
not as much but close
 
Ven's on a roll today
 
11:19 AM
That's an X-Y-Z-A-B-C-D-E-F-G problem.
 
This is a X-C++ problem
 
@Ven There is no problem that cannot be solved with the right HQ9+ extension.
 
Annnnd
 
yeah i mean, is it really alright when your'e forced to make a recursive func every time you need a loop?
 
it doesn't work. <_>
 
11:19 AM
cue HQ9++
 
Think I'm gonna take a nap.
 
to me that sounds like a waste of time and screen space
 
@iksemyonov "need" is wrong there. And so is "forced".
 
how so?
 
You don't "need" loops. You use them.
 
11:20 AM
@iksemyonov That's not true. You should refrain from commenting before you study some more.
 
@ThePhD doing ocaml?
 
they're shorter than the alternatives aren't they?
 
@iksemyonov Not necessarily
 
@Code-Apprentice hating my life yes, doing OCaml
 
I am pretty sure my haskell programs are more concise than my programs in any language, but I'm not sure if that's any kind of point.
 
11:21 AM
@iksemyonov 99% of the time I write Haskell I don't write recursive functions unless I'm actually dealing with recursive data structures.
 
If you were actually meaning to say "more practical", this obviously depends on the language. In some languages recursion is more practical than loops.
 
Ven
Alan Perlis doesn't want you to get cancer of the semicolon!
 
@ThePhD never played with it.
 
@R.MartinhoFernandes well, for me, i first met that recursion instead of looping idea when i came across Erlang, and was really surprised since it just wasn't effective
3
 
@iksemyonov What alternatives?
You clearly don't know enough alternatives to be in this discussion.
 
11:22 AM
How do I even separate these two function calls...
 
@iksemyonov That's why no one actually uses recursion in real code.
 
@R.MartinhoFernandes sorry, will go back to programming
 
yeah, that's the other thing, you use higher-order primitives
@iksemyonov have you tried reading instead?
 
Ven
Sometimes you get starred for saying something smart... Sometimes you get starred for saying something stupid.
 
11:23 AM
@R.MartinhoFernandes well, the reason I don’t write recursion in actual Haskell is that I can’t be bothered
 
the reason I don't write recursion in actual Haskell is that I don't write Haskell
 
@Ven was that stupid?..
 
Ven
Very misguided, at least.
 
@LucDanton Do you avoid explicit revision or do you also mean functions like map and filter, too.
 
> revision
what is going on in here today
 
11:25 AM
@Code-Apprentice I’m always very deliberate when I commit
 
Wait
am I supposed to nest these functions
 
@iksemyonov Basically you're just presenting strawmen and false dichotomies ("there are only loops or recursion")
 
or can I jsut separate them with a ;
 
@LucDanton I'm not sure what that means so I'll just nod my head and smile.
 
Ven
@ThePhD you can rely on indentation
 
11:29 AM
@R.MartinhoFernandes yeah, i guess i better go back to programming and learning actual problem domains. think i read somewhere once that in "functional" languages, recursion is used instead of explicit looping, probably because data is unmodifiable
aren't languages just tools? mean, for some they are a subject of academic interest and that's really great, but in the end, it's a tool, and it has to be comfortable to use
 
Ven
@ThePhD you mean ;; btw ;)
 
well, effective to use
 
Ven
yes
your function does nothing
it returns an empty map
 
Oh, i forgot to pass words
 
Ven
11:33 AM
it's | h :: rest -> accumulate (update_count map h) rest
 
Not that it matters: it doesn't compile in the first place.
Wait, what.
Why like that?
 
@iksemyonov That's not disputable, but there's a difference between "comfortable to use" and "comfortable to use when you don't know how to use it".
 
Ven
because you need to update the map
 
No I mean
 
As an example, C++ is horrible when it comes to the latter, because UB.
 
Ven
11:34 AM
reminder: map is accumulate's first argument. you forgot about it here
 
accumulate ( update_count map h ) rest
That's not calling accumulate on update_count's result?
 
Ven
yes it is. you need to update the map
 
Okay, so I have to make update_count return map, then?
 
Ven
yes
 
My head hurts.
 
Ven
11:36 AM
no
 
So I do find, if find fails, I need to return 0 and the map itself,
 
Ven
remember it's immutable. So you need a new map
no
 
otherwise, I need to return the new map?
No??
 
Ven
if find fails, you return map with {word => 1} added
otherwise you return {word => find's_return_value + 1}
 
I need to clone the map then... and then add to it?
Or... do I just get the val, and then add over it
Does add throw an exception if you've already got a key in there..?
 
Ven
11:39 AM
no
you're still thinking in mutable things
nothing ever changes.
 
let update_count key map =
	try StringMap.find key map with
		| val -> StringMap.add key (val + 1) map
		| Not_found -> StringMap.add key 1 map;;
Except that's probably wrong
since try ... with is for exceptions
Fuck this is so dump hard
 
Ven
yeah you just want match
 
But how do I match on a Not_found exception?
 
Ven
ah, right
you can't.
 
<_>
pls
 
Ven
11:41 AM
you do need to catch the exception
I forgot ocaml was retarded
 
I... give up.
I can't get through these compiler errors. =/
 
Ven
@ThePhD no you're not
you just need to figure out how to catch an exception and your program is doneâ„¢
 
How does OCaml's type definitions manage to be WORSE than C++ templates.
That's a fucking accomplishment, FFS.
When my templates error I get diagnostics that at least tell me the type, or at the very least a typedef.
 
Ven
because you lived in C++ templates for years and years and in Ocaml's type system for minutes
 
^
 
11:51 AM
@R.MartinhoFernandes i'll think well about your words
 
Ven
"I have 10.000hrs of experience doing X, why is doing Y so hard?"
 
I have 10,000 hours of reading error messages from all sorts of languages: why are Y's so bad?
 
@R.MartinhoFernandes don't think i'm "dumbheaded" in a sense, a good while ago i realized how diverse things are and since then been trying to expand the horizons so to say. so , will think
 
@Ven lol
 
@iksemyonov When I say you don't know enough, I don't mean to say it is for lack of ability. You just have stuff to learn still. Unlike me, humans haven't learned everything yet.
 
11:58 AM
lol ThePhD picking up OCaml
@Luc dunno if your style but you might enjoy this
 
@PatrickM'Bongo c’est ton petit cousin qui a commis ça ?
 
@LucDanton non, c'est du travail de pro (et les fautes sont intentionnelles deux elles eu ess)
 
@R.MartinhoFernandes it's also horrible when you do know how to use it, IME
I mean sure you can say that I don't know it good enough
Can't really debate that
 
@PatrickM'Bongo y’a le niveau 0 mais ça c’est même pas ça
et puis c’est NSFW aussi alors mersi
 
@ThePhD them being C++ and Java and C#? Good luck.
 
12:14 PM
@LucDanton quoi t'aimes pas
 
It's really not helping that the type specifications are weird as fuck for the Module docs and shit.
 
@PatrickM'Bongo je sais pas trop mais l’un dans l’autre ça change rien à ce que j’ai dit
 
key -> 'a -> 'a t -> 'a t
So I give it a key... AND a map?
Or I give it a key, and it produces a map, that produces a... what.
Things cna only have 1 return value, right? So maybe every on the left are arguments.
And the rightmost is the return value.
 
@ThePhD is this add?
 
@Griwes Yeah
 
12:18 PM
(I'm guessing from comparison with the docs. :P)
 
@BartekBanachewicz so why not getConfigConfigConfigConfigConfigConfigConfigConfigConfigConfigConfigConfigConf‌​igConfigConfigConfigConfigConfigConfig....()?
 
@ThePhD You give it a key, and a value, and a map, and it gives you a map.
Or, you give it a key and a value, and you get a function adding that to the map.
Or, you give it a key and get a function that takes a value and gives you a function that inserts that into a map.
@ThePhD It's curried.
It's not a function with n arguments returning a value, it's an nth-order function returning an (n-1)th order function returning... and so on.
 
a curry
 
.-.
 
Are you seriously trying to write OCaml before learning what currying is? :D
 
12:21 PM
currying, the process of making plain boring chicken v tasty
10
 
It would have helped if anyone explained what currying was and where it was used in OCaml (e.g., apparently fucking everywhere).
 
currying is the bread and butter of functional languages
 
@ThePhD if this was a haskell signature, I'd read it as a function which takes one argument and returns a function which takes an argument and returns a function which...
 
@ThePhD I think most introductory courses start with that no?
 
@ThePhD Of course it's everywhere, it's a functional language, it'd be insane without that.
In mathematics and computer science, currying is the technique of translating the evaluation of a function that takes multiple arguments (or a tuple of arguments) into evaluating a sequence of functions, each with a single argument. Currying is related to, but not the same as partial application. Currying is useful in both practical and theoretical settings. In functional programming languages, and many others, it provides a way of automatically managing how arguments are passed to functions and exceptions. In theoretical computer science, it provides a way to study functions with multiple arguments...
 
12:23 PM
 
@PatrickM'Bongo ok maintenant je vais avoir besoin de thérapie pour faire face à la réalité que ce sont de vrais albums publiés et tout merci vraiment
 
@LucDanton J'achète la suite dès que je rentre au bercail
 
Oh my FUCKING god
It finally compiles AND RUNS
 
wee wee, moy be en
 
No fucking idea if it's doing what I want but WHO CARES
 
Xeo
12:25 PM
Does it produce the correct results too?
 
happy tummy?
 
@Xeo Well, since this is a functional language the chances are that it's ~*^%$ Correct By Construction $%^*~
 
lol
 
@thecoshman wow is that a muy bien
 
maybe :D
 
12:32 PM
Lord help me I'm trying to use fold
 
@ThePhD easy, that's just std::accumulate with a non-retarded interface
 
@Griwes "non-retarded" :I
 
Yes.
Non-retarded.
Unlike std::accumulate.
kek having to use reverse iterators to switch from foldl to foldr.
 
Let me get back to you on that while I figure out how the hell I'm suppsoed to call something whose signature is ( ... ) -> ... -> ... -> ...
I'm gonna guess () means "I take a function that takes these parameters".
 
'folf' is a term for "take a collection and do something with all the values to come up with one final output value", right? like, add up all the values in a list?
I find the hardest thing with all this stuff is remembering the fancy terms for things :{
 
12:36 PM
Okay, if there's 'a, what the hell is 'b ?
 
Let's say you have (Haskell notation, don't want to check the differences with OCaml) foo :: (a -> b) -> a -> b) is a function that takes a function from a to b and returns a function that takes an a and returns a b.
 
Just some other generic type?
 
Yes.
 
<_>
 
I guess the OCaml type for that is ('a -> 'b) -> 'a -> 'b.
 
12:37 PM
No, it's weirder.
 
For that, where that is my example. :P
 
val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
 
My head hurts.
 
That takes a function taking a key, a value, the accumulator, and returns the new accumulator as the first argument.
 
12:39 PM
Wait, what
That's what 'b is?
 
Then takes a map, then the initial value of the accumulator.
And returns the final accumulator value.
 
...
So how does that help produce a single value?!
 
What?
 
Or even a collection of values
 
It's accumulate.
Literally.
 
12:40 PM
figuratively
 
I takes the accumulation operation, the collection, the initial value, and returns a final value.
 
@ThePhD are you wrapping your head around this?
 
nwp
I hate when I close firefox, notice there is another firefox window open, close that one and then when I open it again it lost all my tabs.
 
No.
 
12:41 PM
lol
Then ask questions!
 
nwp
Maybe using tabs as bookmarks is not the greatest idea after all.
 
do you get what the key -> 'a -> 'b -> 'b parameter is?
I don't think do, as that reads ambiguously to me
feels like it needs commas in there
 
No, it's curried.
It takes one value and returns a function.
Which in turn takes a value and returns a function.
Which in turn takes a value and produces a value (a constant function really).
 
Xeo
The fuck's that key for
 
@Xeo It's folding over a map.
 
Xeo
12:44 PM
okay
Is t somehow restricted, then?
 
No idea, I'm just helping with understanding how curried signatures work. :P
 
Annnd my code fails again.
FFafwfwafwafwaf.
I'm trying to turn this map into a list of tuples.
I tried StringMap.bindings, that didn't work out
 
@Xeo type 'a t = 'a Map.Make(String).t
It's irritating because it's backwards. :P
@ThePhD Define "didn't work out", the signature looks like it's exactly what you need...
 
Xeo
I knew t was the map type, but it seemed weird that there was no reference to the key in there
 
@Xeo There's also type key = String.t there.
OH COME ON SUCKCHAT
 
Xeo
12:49 PM
Wait, where are you getting that from? Did PhD paste it somewhere?
 
I like how empty is polymorphic.
@ThePhD Don't be so quiet, you don't have to deal with this alone <3
 
:< I-I don't need a support group!
 
Xeo
ah, so t and key are specific to that file (or something), gotcha
 
Ven
aw my love letter to Mysticial disappeared off the starboard =[
 
@ThePhD You clearly do :D
 
12:53 PM
tfw no print_tuple, print_list, print ...
 
Ven
I sure hope you're using Core or Batteries_included ._.
 
Uh.
Maybe?
 
Ven
no you're not
 
List.iter (let ( x, y ) = print x; print y) listcounts;;
Sob Why won't anything I try just work?
dhawjdawkdADhwad AND OF COURSE THERE'S NO OVERLOADING
This language is a paaaaaain.
 

« first day (2175 days earlier)      last day (2770 days later) »