At first I thought it'll pretty boring since it's the first "basic" problem of HackerRank. But ... I couldn't be more wrong, it was truly instructive. I hope you'll make more video like that. I'm currently learning haskell and I struggle quite a bit to solve problem in a pure functionnal and point-free way, so it's quite helpfull to see the entire process. Thank you.
Never saw someone explain so many important concepts so easily with easy problems on the coding content websites. You redefine programming pedagogy @tsoding. hats off.
Man, I spent hours fumbling around with command line arguments, and I could have saved all that time if I had just watched this video first. Why is `interact` not suggested more often?! Incredibly informative video in such a concise package. Really great stuff.
crazy! I tried doing the Haskell hacker rank problems and I thought "wow, apparently I don't know much about Haskell" when I saw the many lines of pre-filled code. I feel much more confident now. Thank you.
Expected some meme to see people solve Hackerrank problem with Haskell. I have to say, I was amazed by how Haskell solved problem. Your instruction is clear and compact. Can't wait to see the next video🤘
They are auto-generated from some generic meta-language, which is probably written in a imperative style. Automatically translating them into a non-imperative style would probably be more difficult than keeping the same style in all languages.
Currently studying Haskell. This is a great video. I'm ready for more. The tune at the end sounds like Ozzy Osbornes "Crazy Train"....at the least a simile.
Oh yeah, it does! Wow! Thanks for letting me know. :) I never listened to Ozzy Osbourne, so I was unaware that I accidentally stole his idea. :D That tune was born when I was improvising on my MIDI controller. ua-cam.com/video/WGEV2SSxgSE/v-deo.html
Good video. But though you rightly point out that those verbose samples from HackerRank are ridiculous (DuplicateRecordFields? openFile stdout? hFlush??) I'd say you shouldn't just always present the shortest possible solution. Ok, in these tasks there was really no reason to use more than a simple point-free composition chain, but even here you should at least add type signatures. Any beginner should immediately get used to doing that for all top-level functions.
No, that's exactly why no one uses haskell. Because beginners are always told to do this and that. This is a coding challenge, so you try to avoid as many extra syntax as possible. The type is not intended for one off one liners, but rather for programs that are to be maintained by people.
@@bratezoran2102 types are useful for _any_ task, including simple one-liners. Figure out what type you want first, and the compiler (with typed holes etc.) makes it twice as easy to get the implementation right as well.
@@leftaroundabout Why? It's obviously not easier for me, or I would use it in one liners. I know what you mean, but this is definitely not applicable for simple functions like that. No benefit for me. About the compiler, you can do stuff like `map ((*1).read) $ words "2 4 9 5 6 2"` to even omit the type in those cases. I think this has a great learning benefit as well, and it's better for shortest mode challenges. Learning is not always about best practices. Again, challenges are about speed, and sometimes it's even fun to make the code as unreadable as possible to confuse people. Something you don't have the freedom to do on real code projects. I think it's much better to try out yourself at what point you need the notation because your drowning in chaos. No better learning effect than that. And for these videos, showing the competitiveness is the most important thing to promote haskell.
I went through quite a few of Hackerrank's Ruby problems just to check out the site and it was awful. On every problem I had to post comments about how the problem was not correctly specified or how the tests were broken. They deleted my account... And of course the problems would teach a Ruby noob a very bad coding style. Just like the haskell problems you showed in the video. Great video, dude.
Those incorrectly specified tests teach you a very important lesson. In real life, the business owner will specify his tasks incorrectly. So Hackerrank problems will teach you to deduce correct specification form the data without upsetting the non-technical person by telling him that his specification is wrong.
Awesome stuff! I really like the lens library for stuff like this. It took me a while to learn but eventually you can write: interact $ show . sumOf (worded . _Show)
Sure lenses are great. _Show is actually a prism, which means it has error handling built-in (unlike `read`, which will crash on non-number input) but allows very simple ignoring of all error cases by using it as a traversal (specifically, as a fold). That can be a double-edged sword though - your proposed code will accept "1 2 3 blearg 9" without complaining, but arguably it would be better to crash on such malformed input than to silently ignore it.
How can I submit Haskell code for HackerRank problems? - Maybe write a Haskell interpreter in one of the HackerRank supported languages and pass the Haskell program as a string parameter to this interpreter.
Love this. I want to learn Haskell but am finding it difficult to actually apply what I am learning. I would love to see more practical examples of full programs. I imagine that the HackerRank problems get much more involved, so it will be highly educational to see how someone handles the problems from start to finish.
Awesome video!! Well explained!! I'm begginer, that found your tutorials after reading some haskell documentation. No extended knowladge of other languages. Keep up the good work. One question though, bare in mind, newbie here.. What is the editor you're using? Tryed to setup sublime for it, but it doesn't work.
It bugged me the functions in function composition are in the reverse order, but hopefully they don't have to be with the use of (>>>) from Control.Arrow: interact $ words >>> tail >>> map read >>> sum >>> show
This is because of Type inference wiki.haskell.org/Type_inference Basically, since sum takes a bunch numbers as an input the compiler figured out that read should return number, so we don't have to say it explicitly.
what doesnt the final code work when I compile it and run it in the command line. its not outputting the answer for me? i do something like this ./haskellRank1 2 3 and it never returns anything. i tried with parens and quotes too?
it reads from standard input, not the commandline arguments ./haskellRank 1 2 3 ^^ arguments run the program then type in "1 2 3" and press enter ./haskellRank
Tsoding I thought it was Russian, wasn't quite sure though. No issues understanding you or anything. I'm currently learning Esperanto, it's meant to be a universal language that's easy to learn(currently only about a million speakers) you should check it out
There is a meaning to having templates, in isolating what your task is. The task wasn't to parse input streams into numbers, but to fill in the body of one function. Unfortunately, the scaffolding was indeed ridiculous. E.g. compare: arTemp Int) . words $ arTemp ar :: [Int]
At first I thought it'll pretty boring since it's the first "basic" problem of HackerRank. But ...
I couldn't be more wrong, it was truly instructive. I hope you'll make more video like that.
I'm currently learning haskell and I struggle quite a bit to solve problem in a pure functionnal and point-free way, so it's quite helpfull to see the entire process.
Thank you.
“they provide you with a sample ... but this is not how you program in haskell”
me (imperative programmer): this guy is worth watching
Why did the comedian learn Haskell? Because it is great for one liners!
take 5 $ repeat "clap"
@@123coolmik replicate 5 "clap"
@@steffahn good code!
I love this community
@@steffahn ["clap" | x
This had way more quality then the Haskell classes I had in college...
Love it. I just started learning Haskell and this one video has already taught me several things. Looking forward to more!
Hey really appreciate these videos ! Keep going man, I think the Haskell community needs more presence in UA-cam as a mean of teaching. Thanks !
Excellent explanation! One of the best I've seen. So clear and sequential. You have so much potential.
Never saw someone explain so many important concepts so easily with easy problems on the coding content websites. You redefine programming pedagogy @tsoding. hats off.
"Super easy" - I guess everybody likes to suffer in a different way, I like yours.
Thanks! You are the best, man. Love your speed, energy and taste for good functional programming.
I am learning Haskell and this was really motivating
Hey man, I just saw your video and I need to say it's really good. This video made me want to learn haskell.
Man, I spent hours fumbling around with command line arguments, and I could have saved all that time if I had just watched this video first. Why is `interact` not suggested more often?! Incredibly informative video in such a concise package. Really great stuff.
crazy! I tried doing the Haskell hacker rank problems and I thought "wow, apparently I don't know much about Haskell" when I saw the many lines of pre-filled code. I feel much more confident now. Thank you.
Amazing video, I hope this series will continue. I love the editing, you're not wasting any of my time
Just started learning haskell and this is series is **great**!
Expected some meme to see people solve Hackerrank problem with Haskell.
I have to say, I was amazed by how Haskell solved problem. Your instruction is clear and compact. Can't wait to see the next video🤘
I want to know coding in haskell, and your tutorial comes at a good time. Thanks for your initiative and i hope we will have more tutorials.
you're videos are amazing! Thank you so much for making the world a better place!
8:28 this is such an iconic moment
Those templates they provide are awful (X_X)
Dope video though!
They are auto-generated from some generic meta-language, which is probably written in a imperative style. Automatically translating them into a non-imperative style would probably be more difficult than keeping the same style in all languages.
Thoroughly enjoying these!
This single line of Haskell Code is worth a Haskell Introduction course!!!
Hope you continue these! Should help me in my FP classes :o
Great language, great guy, thank you
Currently studying Haskell. This is a great video. I'm ready for more. The tune at the end sounds like Ozzy Osbornes "Crazy Train"....at the least a simile.
Oh yeah, it does! Wow! Thanks for letting me know. :)
I never listened to Ozzy Osbourne, so I was unaware that I accidentally stole his idea. :D That tune was born when I was improvising on my MIDI controller. ua-cam.com/video/WGEV2SSxgSE/v-deo.html
really enjoyed this one, please keep making them
I will probably never write a single $ in Haskell ("line" did not work out here, obviously). But this vid earned you a subscription. Oh man...
Amazing Bro.
I like your point of view!
excited for this series
This channel is better than 99% of all books out there.
Очень круто, спасибо :) Давно хотел haskell поучить и английский подтянуть)
Wow okay. Interesting... I should learn Haskell.
This is awesome! Hope to see more and more of these!
Awesome video thank you! Please continue making more Haskell videos 😁
What a crazy stuff, you are a genius.
Чую рашн аксент. Найс видео, keep going.
Окружение комнаты тоже намекает)
Thanks man, love your videos!
Amazing Video! Looking forward for the next part! Keep going!
This-is-really-amazing 😮 😊
Good video. But though you rightly point out that those verbose samples from HackerRank are ridiculous (DuplicateRecordFields? openFile stdout? hFlush??) I'd say you shouldn't just always present the shortest possible solution. Ok, in these tasks there was really no reason to use more than a simple point-free composition chain, but even here you should at least add type signatures. Any beginner should immediately get used to doing that for all top-level functions.
No, that's exactly why no one uses haskell. Because beginners are always told to do this and that. This is a coding challenge, so you try to avoid as many extra syntax as possible.
The type is not intended for one off one liners, but rather for programs that are to be maintained by people.
@@bratezoran2102 types are useful for _any_ task, including simple one-liners. Figure out what type you want first, and the compiler (with typed holes etc.) makes it twice as easy to get the implementation right as well.
@@leftaroundabout Why? It's obviously not easier for me, or I would use it in one liners. I know what you mean, but this is definitely not applicable for simple functions like that. No benefit for me. About the compiler, you can do stuff like `map ((*1).read) $ words "2 4 9 5 6 2"` to even omit the type in those cases. I think this has a great learning benefit as well, and it's better for shortest mode challenges. Learning is not always about best practices.
Again, challenges are about speed, and sometimes it's even fun to make the code as unreadable as possible to confuse people. Something you don't have the freedom to do on real code projects.
I think it's much better to try out yourself at what point you need the notation because your drowning in chaos. No better learning effect than that. And for these videos, showing the competitiveness is the most important thing to promote haskell.
@@leftaroundabout I totally agree otherwise that types are the most important concept to learn about haskell and one of its greatest features.
This is mind expanding.. class!
Clear and concise!
"Super easy. Next problem."
Great stuff, keep it up!
Love the video keep on going really interesting content.
So cool, I didn't know about interact
So interesting! Thank you.
I went through quite a few of Hackerrank's Ruby problems just to check out the site and it was awful.
On every problem I had to post comments about how the problem was not correctly specified or how the tests were broken. They deleted my account...
And of course the problems would teach a Ruby noob a very bad coding style. Just like the haskell problems you showed in the video.
Great video, dude.
Those incorrectly specified tests teach you a very important lesson. In real life, the business owner will specify his tasks incorrectly. So Hackerrank problems will teach you to deduce correct specification form the data without upsetting the non-technical person by telling him that his specification is wrong.
This was great! Really interesting
Great video!
Great video. Off to learn Haskell!
I want a ”how bout dat” t-shirt with Alexey’s face on it.
I think, haskell having a very steep learning curve, might get people more dopamine from it, everyone should start learning haskell
Awesome stuff! I really like the lens library for stuff like this. It took me a while to learn but eventually you can write: interact $ show . sumOf (worded . _Show)
Thanks! Lens are on my TODO list for quite a while already. I think it's time give them a try.
Sure lenses are great. _Show is actually a prism, which means it has error handling built-in (unlike `read`, which will crash on non-number input) but allows very simple ignoring of all error cases by using it as a traversal (specifically, as a fold). That can be a double-edged sword though - your proposed code will accept "1 2 3 blearg 9" without complaining, but arguably it would be better to crash on such malformed input than to silently ignore it.
now haskell appears even better for me, cause I don't have to waste my time with getLines
holy shit... that was badass
great work sir
Perfect!
How can I submit Haskell code for HackerRank problems? - Maybe write a Haskell interpreter in one of the HackerRank supported languages and pass the Haskell program as a string parameter to this interpreter.
Wish they taught us Tolstoy War and Peace in Haskell too.
Fantastic
I guess Haskell is my next language to learn.
very nice content!!!!
Love this. I want to learn Haskell but am finding it difficult to actually apply what I am learning. I would love to see more practical examples of full programs. I imagine that the HackerRank problems get much more involved, so it will be highly educational to see how someone handles the problems from start to finish.
Awesome video!! Well explained!! I'm begginer, that found your tutorials after reading some haskell documentation. No extended knowladge of other languages. Keep up the good work. One question though, bare in mind, newbie here.. What is the editor you're using? Tryed to setup sublime for it, but it doesn't work.
He uses emacs with Haskell Plug-in
OMG, this is great! and why are you not using Xmonad? LOL
It bugged me the functions in function composition are in the reverse order, but hopefully they don't have to be with the use of (>>>) from Control.Arrow:
interact $ words >>> tail >>> map read >>> sum >>> show
Same I was perplexed at first but I guess you can get used to it with time.
Noice video. I hope you make more.
Could you tell me what is the title of the ending song?
I don't know! I still didn't come up with the title yet. :) ua-cam.com/video/WGEV2SSxgSE/v-deo.html
:O you made it?? Awesome
Kinda sound like crazy train ;)
Okay I am sold.
This is awesome! Thank you so much and I really hope you continue with these videos!!
didn't quite get how you can omiss the type parameter on the read function, or is it a "cast"?
This is because of Type inference wiki.haskell.org/Type_inference Basically, since sum takes a bunch numbers as an input the compiler figured out that read should return number, so we don't have to say it explicitly.
You're awesome
More videos the Haskell Please ¡¡¡¡¡ Thanks
Damn bro you really popped when you lost weight. Good shit!
what doesnt the final code work when I compile it and run it in the command line. its not outputting the answer for me? i do something like this ./haskellRank1 2 3 and it never returns anything. i tried with parens and quotes too?
it reads from standard input, not the commandline arguments
./haskellRank 1 2 3
^^ arguments
run the program then type in "1 2 3" and press enter
./haskellRank
@@ulissemini5492 interesting, not sure why I couldn't get that. I guess I expected it to print something before I sent Ctrl + D 'EOF'
@@billyblackburn864 yeah its confusing at first, a good way to tell is that it works with type 'String' not type '[String]' :-)
Great. thnx
nice video
Have a look at codewars.com. There are some really great Haskell challenges.
Do you know any interesting functions in Haskell?
Interesting
Can you do a series for some Codeforces problems , please ??
I really want to add Haskell to my repository of languages I know really good
Cool!
Is english a your first language? If not what was it? And if it was then where were you raised?
(Just curious is all)
My first language is russian, english is my second one.
Tsoding I thought it was Russian, wasn't quite sure though. No issues understanding you or anything. I'm currently learning Esperanto, it's meant to be a universal language that's easy to learn(currently only about a million speakers) you should check it out
actually HackerRank is confusing with the template
But what is a monad
1-1=1/2
imul 0=?
I had the same feeling solving problems in a couple of Python lines
There is a meaning to having templates, in isolating what your task is. The task wasn't to parse input streams into numbers, but to fill in the body of one function. Unfortunately, the scaffolding was indeed ridiculous. E.g. compare:
arTemp Int) . words $ arTemp
ar :: [Int]
👍🏼
hej man, are you from Russia?
yay, no php anymore
ИЗИ!
100%
your channel is a fucking goldmine
o.O
Excellent (atlichna)