HackerRank in Haskell -- HaskellRank #01

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

КОМЕНТАРІ • 131

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

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

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

    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!

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

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

  • @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 !

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    8:28 this is such an iconic moment

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

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

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

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

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

    really enjoyed this one, please keep making them

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

    Great language, great guy, thank you

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

    Thoroughly enjoying these!

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

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

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

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

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

    Amazing Bro.
    I like your point of view!

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

    excited for this series

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

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

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

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

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

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

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

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

    What a crazy stuff, you are a genius.

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

    Love the video keep on going really interesting content.

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

    This is mind expanding.. class!

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

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

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

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

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

    Clear and concise!

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

    Great stuff, keep it up!

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

    So cool, I didn't know about interact

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

    Thanks man, love your videos!

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

    This-is-really-amazing 😮 😊

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

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

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

    So interesting! Thank you.

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

    Great video. Off to learn Haskell!

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

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

    "Super easy. Next problem."

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

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

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

    Great video!

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

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

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

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

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

    This was great! Really interesting

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

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

    Perfect!

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

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

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

    great work sir

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

  • @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 ;)

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

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

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

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

    holy shit... that was badass

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

    very nice content!!!!

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

    More videos the Haskell Please ¡¡¡¡¡ Thanks

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

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

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

    Fantastic

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

    I guess Haskell is my next language to learn.

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

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

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

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

    You're awesome

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

    Okay I am sold.

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

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

    Do you know any interesting functions in Haskell?

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

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

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

    nice video

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

    Great. thnx

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

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

    But what is a monad

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

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

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

    Interesting

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

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

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

    Cool!

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

    actually HackerRank is confusing with the template

  • @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]' :-)

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

    1-1=1/2
    imul 0=?

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

    100%

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

    ИЗИ!

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

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

    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 років тому

    👍🏼

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

    yay, no php anymore

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

    hej man, are you from Russia?

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

    your channel is a fucking goldmine

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

    o.O

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

    Excellent (atlichna)