peppidesu
peppidesu
  • Видео 5
  • Просмотров 194 928
Your code can be beautiful AND fast (Higher order functions)
Thank you all for watching! If you want to see more of this, consider subscribing!
In this video we will talk about higher-order functions - one of the main pillars of Haskell, and how they can help you write elegant and decently fast code with little effort.
Since this video covers a topic that has many strong opinions, I want to make clear that I do not appreciate flaming or irrational discussion in the comments. If you think I or someone else is wrong, be concrete and provide a source if you can.
========================================================
0:00 Introduction
0:47 Built-in functions
1:04 Hoogle
1:47 Functions as arguments
2:35 Lambda notation
2:59 Building the map function
4:35 The n...
Просмотров: 14 563

Видео

Recursion - To hone a skill, one must practice.
Просмотров 20 тыс.11 месяцев назад
Thank you all for watching! If you want to see more of this, consider subscribing! In this video we will talk about recursion and how Haskell forcing it upon you is an opportunity to practice working with it. We will also look into how lists work in Haskell, and how these two design choices go hand in hand. Since this video covers a topic that has many strong opinions, I want to make clear that...
Binary Representations - The Ultimate Guide (06/01/23 @ CROW ACADEMY)
Просмотров 1,6 тыс.Год назад
This is a recording of a talk I did yesterday over at the CROW ACADEMY discord server, for those who missed it.
How to read Haskell code (in 7 minutes)
Просмотров 54 тыс.Год назад
Hope you liked the video! This took a while to make (mostly bc of uni stuff getting in the way). In this video, I will be going over the basics of Haskell syntax. Haskell is syntactically very different from other languages, so this video should clear up a lot of confusion around Haskell code. I won't assume you understand everything covered in this video going onward, this is just to make sure...
You want to learn Haskell. This is why.
Просмотров 105 тыс.Год назад
If you want to see more of this content, leave a like! This is an introduction to an upcoming tutorial series about programming in haskell. A lot of people complain about haskell being complicated and unintuitive, and although it definitely has its flaws, it forces you into thinking about code in a entirely different way. Discord server: discord.gg/pAYbVwn5hR Twitch: twitch.tv/peppidesu Patreon...

Комментарии

  • @krazyolie
    @krazyolie 18 часов назад

    I learned haskell in first year CS.. Whilst completely impractical it was a good way to look at some things.

  • @learning-og4to
    @learning-og4to День назад

    this channel is great. you explain these concepts very well

  • @blindshellvideos
    @blindshellvideos 3 дня назад

    haskell sucks

  • @zsuato
    @zsuato 12 дней назад

    this is so cool

  • @nelsonjanusson7278
    @nelsonjanusson7278 17 дней назад

    damn..... even the title is declarative.

  • @ClayShentrup
    @ClayShentrup 17 дней назад

    type signatures are an anti-pattern. just use inference.

  • @IllusionDX
    @IllusionDX 23 дня назад

    I can barely understand simpler code that does things step by step, I don't want to make it harder for myself

  • @3_14pie
    @3_14pie 25 дней назад

    so python is just dumb haskell?

  • @1..1..1..1H
    @1..1..1..1H Месяц назад

    No

  • @c0lligo
    @c0lligo Месяц назад

    The sentence "Haskell doesn't even feature variables" deals immense psychic damage to most programmers

  • @donwald3436
    @donwald3436 Месяц назад

    lol monads

  • @posfr292
    @posfr292 Месяц назад

    Wow. That's an absolutely beautiful video. I'm starting to understand it - especially with the aid of those fantastic function / higher-order function (HOF) diagrams. One comment, however: there appears to be a minor typo in the "Wrapping up" diagram at around 07:36. I think that the output of the filter HOF should possibly have the type [a]. Having just subscribed to your channel, I'm going to watch more of your Haskell videos in my quest to understand functional programming with TypeScript (of all things - possibly with the aid of the fp-ts library). Thank you.

  • @oPatrickVico
    @oPatrickVico Месяц назад

    Awesome video! Hope your channel blows up

  • @alexanderskusnov5119
    @alexanderskusnov5119 Месяц назад

    2:49 foo needs a function of one argument (type a), it's not a plus function of 2 arguments (x, y).

  • @adryelbarros3250
    @adryelbarros3250 2 месяца назад

    def closest(target, points, dist): distances = ((dist(target, p), p) for p in points) _, closest_point = min(distances, key=lambda i: i[0]) return closest_point

    • @adryelbarros3250
      @adryelbarros3250 2 месяца назад

      Ok, I could've used the dist directly in the min function

  • @QuotePilgrim
    @QuotePilgrim 2 месяца назад

    Bro I have been coding in Python since highschool and it took me a while to understand that example at the end of the video.

  • @GeekOverdose
    @GeekOverdose 2 месяца назад

    Sometimes you really wish you had some structural typing 🙂

  • @harune6594
    @harune6594 2 месяца назад

    oh man heartbroken you didnt continue this series

  • @harune6594
    @harune6594 2 месяца назад

    wow, great video

  • @rutieltercero9355
    @rutieltercero9355 2 месяца назад

    COME BAAAACK

  • @RoyaltyInTraining.
    @RoyaltyInTraining. 2 месяца назад

    I instantly fell in love with Rust after learning how to write it in a functional-like way. Now I really want to learn more.

  • @yash1152
    @yash1152 3 месяца назад

    4:09 > _"UTH, Haskell lists look like this"_ wait, this looks (syntax) & sound (name) like lisp lists.

  • @laughingvampire7555
    @laughingvampire7555 3 месяца назад

    stop saying that is a very complicated topic because it isn't

    • @IronicHavoc
      @IronicHavoc 2 месяца назад

      It is to some people, and they often get turned away when someone says it's simple. It's not like hes saying its impenetrable, just chill out.

  • @dycan0716
    @dycan0716 3 месяца назад

    Any tutorial about vizualisation in the new perspective section? looks sophisticated.

  • @0LoneTech
    @0LoneTech 3 месяца назад

    There is *lots* of overhead in the for loop you showed to begin with, specifically on the programmer's side! Compare: int factorial(int n) { int product=1; for (int factor=1; factor<=n; factor++) product*=factor; return product; } factorial :: Int -> Int factorial n = product [1..n] Why should the programmer repeatedly explain to the compiler how to iterate through numbers every time they want to handle any sort of sequence? It's even done with the full expectation the compiler will recognize the pattern and discard those details, in order to perform optimization like using CPU flags, unrolling, vectorization etc; which means there's another load of overhead on the compiler's side. And then you still have to elaborate for some of those, like #pragma omp reduction (* : product).

  • @user-vg4lp5ox7f
    @user-vg4lp5ox7f 4 месяца назад

    На питоне можно однострочные написать тоже 😂

  • @SilverStarStorm.
    @SilverStarStorm. 4 месяца назад

    Continuation when? :p

  • @user-tx4wj7qk4t
    @user-tx4wj7qk4t 4 месяца назад

    Confusing apply with map is pretty bad for learning. Map is specific to list and really shouldn't be used over fmap but I get why you're taking about it. But recursion isn't something that's ever really used outside of library implementations. You should really be teaching people things like fold because they're just going to get hung up on recursion not being efficient or something Overall tackling it from this angle makes haskell seem no different to any other language. Nothing here is special really

  • @user-tx4wj7qk4t
    @user-tx4wj7qk4t 4 месяца назад

    Tail call recursion is not slower

  • @adriansomor
    @adriansomor 4 месяца назад

    amazing series

  • @mukynas
    @mukynas 4 месяца назад

    Nice try Big Haskell corporate slave

  • @nuisho.studio
    @nuisho.studio 4 месяца назад

    Arguments and parameters are different things. The function declaration (not applying or execution) uses parameters, not arguments.

  • @crazymarxistguy
    @crazymarxistguy 4 месяца назад

    Wow! Just amazing. Incredible video, highly detailed and well explaining, while still remaining very short and concise. Great job!

  • @WayOfTheCode
    @WayOfTheCode 5 месяцев назад

    Amazing videos

  • @user-zs6oh4wp1d
    @user-zs6oh4wp1d 5 месяцев назад

    Great video :D

  • @MrSenserus
    @MrSenserus 5 месяцев назад

    And I don't even need to memory allocate in my brain to learn this - Haskell has it built in!

  • @user-zs6oh4wp1d
    @user-zs6oh4wp1d 5 месяцев назад

    Great video :D

  • @S3Kglitches
    @S3Kglitches 5 месяцев назад

    Haskell is like driving a jet fighter on the road. It's cool and advanced af but its practical usage is low.

  • @TheGRoques
    @TheGRoques 5 месяцев назад

    Thank you. I've been thinking of starting Haskell for many years, and this video series serves as a concise and accessible introduction!

  • @gregoryfenn1462
    @gregoryfenn1462 5 месяцев назад

    Wait, isn't there a massive crashing bug in the factorial code? If i call "factorial (-1)" it will infinitely recurse and never stop. How is this an acceptable coding feature? Surely, the function domain should be limited to unsigned integers (Z+) rather than all Integers?

    • @0LoneTech
      @0LoneTech 3 месяца назад

      Feel free to add «factorial n | n<0 = undefined» if you'd like your failure to be faster. It wasn't going to work either way. As for limiting it to unsigned integers, that would require importing such a type, and Integer is arbitrary size too so will handle large numbers like 22! More concerning is that the form wasn't tail recursive and may take O(n) memory. foldl' and seq exist to address that. Introductory examples rarely address all possible concerns simultaneously.

  • @bravo________87372
    @bravo________87372 5 месяцев назад

    Still just does a for loop under the hood

  • @rico_1617
    @rico_1617 5 месяцев назад

    Nah watch this: import closestPoint from 'closest-point'; let res = closestPoint(point, target);

  • @potatomaaan1757
    @potatomaaan1757 6 месяцев назад

    Here is a version in rust that doesnt clone anything, so should be very fast. It also accounts for the case where the list of points might be emtpy. fn closest<'a>(points: &'a [Point], target: &Point) -> Option<&'a Point> { points.into_iter().min_by_key(|p| distance(&p, target)) }

  • @ashk3734
    @ashk3734 6 месяцев назад

    Haskell is so bad, don't learn it :(

  • @Mashen_Taterz
    @Mashen_Taterz 6 месяцев назад

    Thanks so much. Please keep doing more ❤

  • @mtv.smorodin
    @mtv.smorodin 6 месяцев назад

    looking forward for next episodes! thank you for your content 🎉

  • @mradult6914
    @mradult6914 6 месяцев назад

    This video is so starkly different from the conclusions I've come to in my work experience that it was a little jarring. Great video and I can understand how one would arrive at using recursion more, but based on my work experience I try to avoid recursion at all costs. I have found that recursion tends to tie knots in my code that only get worse over time. I find iterators and their associated for loops to be much more intuitive, and even figured out how to handle trees without recursion by instead building tree-based iterators.

    • @user-tx4wj7qk4t
      @user-tx4wj7qk4t 4 месяца назад

      Lol what are you talking about. First of all, tail call recursion is converted into for loops. Second of all, this is low level iteration you should never be writing, neither for loops nor recursion, unless you've got some performance need. OOP has iterators and FP has HOFs and comprehensions which are 2-3 levels of abstraction above loops and recursion. It also decouples how to iterate from what you want to do as well as isn't specific to a data structure... On top of that it's also much cleaner code

  • @maurolimaok
    @maurolimaok 6 месяцев назад

    I'm just starting my journey at Odin Project, at 56yo At the moment my focus is on the basics, but this is very interesting. Hope to see more like this. Thanks!

    • @user-tx4wj7qk4t
      @user-tx4wj7qk4t 4 месяца назад

      I would advise you to focus on something like PureScript instead. The book "functional programming made easier" teaches you frontend web dev from scratch and you'll learn a lot more than Odin

  • @Sk8erMorris
    @Sk8erMorris 6 месяцев назад

    Hope all is well, wondering for the continuation of the series :)