HackerRank in Haskell -- HaskellRank #01

Поділитися
Вставка
  • Опубліковано 29 жов 2024

КОМЕНТАРІ • 131

  • @user-oe6ys7gx4g
    @user-oe6ys7gx4g 6 років тому +119

    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.

  • @suou7938
    @suou7938 4 роки тому +39

    “they provide you with a sample ... but this is not how you program in haskell”
    me (imperative programmer): this guy is worth watching

  • @tordjarv3802
    @tordjarv3802 6 років тому +314

    Why did the comedian learn Haskell? Because it is great for one liners!

    • @123coolmik
      @123coolmik 5 років тому +31

      take 5 $ repeat "clap"

    • @steffahn
      @steffahn 4 роки тому +19

      @@123coolmik replicate 5 "clap"

    • @jasonleo
      @jasonleo 4 роки тому +1

      @@steffahn good code!

    • @williaamlarsson
      @williaamlarsson 4 роки тому

      I love this community

    • @ishdx9374
      @ishdx9374 4 роки тому +5

      @@steffahn ["clap" | x

  • @alanherculano7661
    @alanherculano7661 6 років тому +48

    This had way more quality then the Haskell classes I had in college...

  • @d3h0ds0n
    @d3h0ds0n 6 років тому +17

    Love it. I just started learning Haskell and this one video has already taught me several things. Looking forward to more!

  • @joaovcarvalho
    @joaovcarvalho 6 років тому +35

    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 !

  • @scifregizmoguy
    @scifregizmoguy 4 роки тому +6

    Excellent explanation! One of the best I've seen. So clear and sequential. You have so much potential.

  • @MeghadityaRoyChaudhury
    @MeghadityaRoyChaudhury 3 роки тому +2

    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.

  • @TBasianeyes
    @TBasianeyes 6 років тому +12

    "Super easy" - I guess everybody likes to suffer in a different way, I like yours.

  • @peterholmstrand
    @peterholmstrand 4 роки тому +2

    Thanks! You are the best, man. Love your speed, energy and taste for good functional programming.

  • @alokdixit417
    @alokdixit417 6 років тому +8

    I am learning Haskell and this was really motivating

  • @xozzy7809
    @xozzy7809 6 років тому +22

    Hey man, I just saw your video and I need to say it's really good. This video made me want to learn haskell.

  • @Jimmy-H
    @Jimmy-H Рік тому +1

    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.

  • @Jupilogy
    @Jupilogy 2 роки тому

    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.

  • @hal_wayland
    @hal_wayland 6 років тому +2

    Amazing video, I hope this series will continue. I love the editing, you're not wasting any of my time

  • @dn5426
    @dn5426 5 років тому +1

    Just started learning haskell and this is series is **great**!

  • @ngochunglongnguyen4523
    @ngochunglongnguyen4523 Рік тому

    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🤘

  • @_esso
    @_esso 6 років тому +1

    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.

  • @thefirstspartan1
    @thefirstspartan1 4 роки тому

    you're videos are amazing! Thank you so much for making the world a better place!

  • @thinkbait8363
    @thinkbait8363 4 роки тому +3

    8:28 this is such an iconic moment

  • @valentjedi
    @valentjedi 6 років тому +61

    Those templates they provide are awful (X_X)
    Dope video though!

    • @asdfghyter
      @asdfghyter 6 років тому +5

      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.

  • @VivekHaldar
    @VivekHaldar 4 роки тому

    Thoroughly enjoying these!

  • @hansschenker
    @hansschenker 3 роки тому

    This single line of Haskell Code is worth a Haskell Introduction course!!!

  • @Felix-fh1vk
    @Felix-fh1vk 6 років тому +6

    Hope you continue these! Should help me in my FP classes :o

  • @madceee
    @madceee 6 років тому +3

    Great language, great guy, thank you

  • @davidyanceyjr
    @davidyanceyjr 6 років тому +2

    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.

    • @Tsoding
      @Tsoding  6 років тому

      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

  • @Simon-cc9ob
    @Simon-cc9ob 6 років тому +1

    really enjoyed this one, please keep making them

  • @turkishmaid
    @turkishmaid 6 місяців тому

    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...

  • @adrwtr
    @adrwtr Рік тому

    Amazing Bro.
    I like your point of view!

  • @mgetommy
    @mgetommy 6 років тому +1

    excited for this series

  • @Fanaro
    @Fanaro 3 роки тому

    This channel is better than 99% of all books out there.

  • @ВладиславБатькович-ф4с

    Очень круто, спасибо :) Давно хотел haskell поучить и английский подтянуть)

  • @fuanka1724
    @fuanka1724 6 років тому +4

    Wow okay. Interesting... I should learn Haskell.

  • @curumu_yt
    @curumu_yt 6 років тому

    This is awesome! Hope to see more and more of these!

  • @buncha1499
    @buncha1499 4 роки тому

    Awesome video thank you! Please continue making more Haskell videos 😁

  • @briancardona344
    @briancardona344 3 роки тому

    What a crazy stuff, you are a genius.

  • @qub0k926
    @qub0k926 6 років тому +2

    Чую рашн аксент. Найс видео, keep going.

    • @felicxo
      @felicxo 4 роки тому

      Окружение комнаты тоже намекает)

  • @sascha-oliverprolic923
    @sascha-oliverprolic923 3 роки тому

    Thanks man, love your videos!

  • @GermanGamingFans
    @GermanGamingFans 6 років тому

    Amazing Video! Looking forward for the next part! Keep going!

  • @abarth0800
    @abarth0800 Рік тому

    This-is-really-amazing 😮 😊

  • @leftaroundabout
    @leftaroundabout 6 років тому +13

    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.

    • @bratezoran2102
      @bratezoran2102 4 роки тому +1

      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.

    • @leftaroundabout
      @leftaroundabout 4 роки тому

      @@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.

    • @bratezoran2102
      @bratezoran2102 4 роки тому +1

      ​@@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.

    • @bratezoran2102
      @bratezoran2102 4 роки тому +1

      ​@@leftaroundabout I totally agree otherwise that types are the most important concept to learn about haskell and one of its greatest features.

  • @WolfBoy2700
    @WolfBoy2700 4 роки тому

    This is mind expanding.. class!

  • @preethamnk
    @preethamnk 6 років тому +1

    Clear and concise!

  • @Chemaclass
    @Chemaclass 4 роки тому +1

    "Super easy. Next problem."

  • @fredbennett5285
    @fredbennett5285 6 років тому +1

    Great stuff, keep it up!

  • @mohamedhajr5370
    @mohamedhajr5370 6 років тому +1

    Love the video keep on going really interesting content.

  • @XOPGAMINGX300
    @XOPGAMINGX300 6 років тому +1

    So cool, I didn't know about interact

  • @chovs
    @chovs 3 роки тому

    So interesting! Thank you.

  • @hectobit
    @hectobit 6 років тому +4

    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.

    • @jacekjacenty
      @jacekjacenty 6 років тому +2

      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.

  • @oldaccountgothacked1
    @oldaccountgothacked1 6 років тому

    This was great! Really interesting

  • @nimashoghi
    @nimashoghi 6 років тому +1

    Great video!

  • @Chase69er
    @Chase69er 5 років тому

    Great video. Off to learn Haskell!

  • @skaramicke
    @skaramicke 3 роки тому

    I want a ”how bout dat” t-shirt with Alexey’s face on it.

  • @XOPGAMINGX300
    @XOPGAMINGX300 6 років тому

    I think, haskell having a very steep learning curve, might get people more dopamine from it, everyone should start learning haskell

  • @brianmckenna4606
    @brianmckenna4606 6 років тому +6

    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)

    • @Tsoding
      @Tsoding  6 років тому +1

      Thanks! Lens are on my TODO list for quite a while already. I think it's time give them a try.

    • @leftaroundabout
      @leftaroundabout 6 років тому

      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.

  • @XOPGAMINGX300
    @XOPGAMINGX300 6 років тому +1

    now haskell appears even better for me, cause I don't have to waste my time with getLines

  • @phelipetelesdasilva5229
    @phelipetelesdasilva5229 4 роки тому

    holy shit... that was badass

  • @shourabhpayal1198
    @shourabhpayal1198 6 років тому

    great work sir

  • @RomanTataurov
    @RomanTataurov 5 років тому +1

    Perfect!

  • @amigalemming
    @amigalemming 5 років тому

    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.

  • @victormikhaltsevich5148
    @victormikhaltsevich5148 4 роки тому

    Wish they taught us Tolstoy War and Peace in Haskell too.

  • @rodelias9378
    @rodelias9378 2 роки тому

    Fantastic

  • @MrBosanskiCevap
    @MrBosanskiCevap 6 років тому

    I guess Haskell is my next language to learn.

  • @catalinoprea5313
    @catalinoprea5313 5 років тому

    very nice content!!!!

  • @lemattbox
    @lemattbox 6 років тому

    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.

  • @ArturRains
    @ArturRains 5 років тому

    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.

  • @meta_escaping
    @meta_escaping 5 років тому

    OMG, this is great! and why are you not using Xmonad? LOL

  • @hckrpl6376
    @hckrpl6376 4 роки тому

    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

    • @sardonyx001
      @sardonyx001 4 роки тому

      Same I was perplexed at first but I guess you can get used to it with time.

  • @user-oj3gb8nh2q
    @user-oj3gb8nh2q 6 років тому +5

    Noice video. I hope you make more.
    Could you tell me what is the title of the ending song?

    • @Tsoding
      @Tsoding  6 років тому +2

      I don't know! I still didn't come up with the title yet. :) ua-cam.com/video/WGEV2SSxgSE/v-deo.html

    • @user-oj3gb8nh2q
      @user-oj3gb8nh2q 6 років тому +1

      :O you made it?? Awesome

    • @erikprantare696
      @erikprantare696 6 років тому +1

      Kinda sound like crazy train ;)

  • @ShubhamBhushanCC
    @ShubhamBhushanCC 4 роки тому

    Okay I am sold.

  • @aBamieh
    @aBamieh 6 років тому

    This is awesome! Thank you so much and I really hope you continue with these videos!!

  • @ThoughtsInVideo
    @ThoughtsInVideo 6 років тому

    didn't quite get how you can omiss the type parameter on the read function, or is it a "cast"?

    • @Tsoding
      @Tsoding  6 років тому +2

      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.

  • @xyaman425
    @xyaman425 4 роки тому

    You're awesome

  • @top_cat26
    @top_cat26 6 років тому

    More videos the Haskell Please ¡¡¡¡¡ Thanks

  • @greatfate
    @greatfate 3 роки тому

    Damn bro you really popped when you lost weight. Good shit!

  • @billyblackburn864
    @billyblackburn864 5 років тому

    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?

    • @ulissemini5492
      @ulissemini5492 5 років тому

      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

    • @billyblackburn864
      @billyblackburn864 5 років тому

      @@ulissemini5492 interesting, not sure why I couldn't get that. I guess I expected it to print something before I sent Ctrl + D 'EOF'

    • @ulissemini5492
      @ulissemini5492 5 років тому

      @@billyblackburn864 yeah its confusing at first, a good way to tell is that it works with type 'String' not type '[String]' :-)

  • @AhmedKhaled-sj1zx
    @AhmedKhaled-sj1zx 6 років тому

    Great. thnx

  • @banuteja4676
    @banuteja4676 6 років тому

    nice video

  • @teliph3U
    @teliph3U 6 років тому +3

    Have a look at codewars.com. There are some really great Haskell challenges.

  • @askmuhsin
    @askmuhsin 5 років тому

    Do you know any interesting functions in Haskell?

  • @tahamagdy4932
    @tahamagdy4932 6 років тому

    Interesting

  • @watari3
    @watari3 4 роки тому

    Can you do a series for some Codeforces problems , please ??

  • @Sinthoras155
    @Sinthoras155 2 місяці тому

    I really want to add Haskell to my repository of languages I know really good

  • @chidaruma_
    @chidaruma_ 6 років тому

    Cool!

  • @toldoth1702
    @toldoth1702 6 років тому

    Is english a your first language? If not what was it? And if it was then where were you raised?
    (Just curious is all)

    • @Tsoding
      @Tsoding  6 років тому +2

      My first language is russian, english is my second one.

    • @toldoth1702
      @toldoth1702 6 років тому

      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

  • @menumenu287
    @menumenu287 3 роки тому

    actually HackerRank is confusing with the template

  • @Norhther
    @Norhther 4 роки тому

    But what is a monad

  • @miguel_lasheras
    @miguel_lasheras Рік тому

    1-1=1/2
    imul 0=?

  • @ac130kz
    @ac130kz 6 років тому

    I had the same feeling solving problems in a couple of Python lines

  • @0LoneTech
    @0LoneTech 4 місяці тому

    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]

  • @dmitrysurkov5632
    @dmitrysurkov5632 6 років тому

    👍🏼

  • @ГарикКубич
    @ГарикКубич 5 років тому

    hej man, are you from Russia?

  • @johnnyphoney5669
    @johnnyphoney5669 6 років тому +1

    yay, no php anymore

  • @ДаниилПрохоров-ю4й
    @ДаниилПрохоров-ю4й 6 років тому

    ИЗИ!

  • @Fullflexno
    @Fullflexno Рік тому

    100%

  • @dewijones92
    @dewijones92 3 роки тому

    your channel is a fucking goldmine

  • @BabaykaMoscow
    @BabaykaMoscow 4 роки тому

    o.O

  • @neilclay5835
    @neilclay5835 6 місяців тому

    Excellent (atlichna)