Higher-order Functions for OO Programmers | Rock the JVM

Поделиться
HTML-код
  • Опубликовано: 8 янв 2025

Комментарии •

  • @binarie
    @binarie 9 месяцев назад +1

    Best explanation I've ever seen. Thanks a lot!

  • @RajeshSamson
    @RajeshSamson 3 года назад +1

    Always worthy to watch your videos....superb content

  • @shakilhaque1822
    @shakilhaque1822 3 года назад +3

    Man that tail recursive HOF incrementer in your topic of 'Higher-order-functions and curries' on your beginner Scala course is super hard to understand (not because of the lacking in your teaching but just hard)....staying optimistic and holding onto the your statement of "rewind and watch this again or play around with the code yourself, and you will be better than 99% of Scala programmers out there when you understand it". To be honest i feel like combining your yt vids with the course actually leads to a MUCH better understanding..like having a teacher explaining the same topic in a different way cause he knows i didn't fully understand it.
    P.S. for anyone reading this who is learning Scala, mark my words that the 1hour wage that Daniel's course is up on Udemy is the best investment you can ever make.

    • @rockthejvm
      @rockthejvm  3 года назад

      That's such high praise, thank you!

    • @d4devotion
      @d4devotion 3 года назад

      This was indeed a hard one to understand.

  • @awadheshsingh7299
    @awadheshsingh7299 2 года назад

    15:35 In line 64, nTimesOriginal(f, n-1).apply(f(x))
    We invoke apply function of nTimesOriginal. But nTimesOriginal has no function apply defined.
    Can you please explain. Thanks.

    • @rockthejvm
      @rockthejvm  2 года назад +1

      Function instances have the apply method.

  • @sebimed5917
    @sebimed5917 3 года назад

    For those interested in how this would look like in Java:
    public static void main(String[] args) {
    // Create Function objects
    Function baseFunction = i -> i + 1;
    Function modifiedFunction = nTimes(baseFunction, 4);
    // Result output
    System.out.println(baseFunction.apply(1));
    System.out.println(modifiedFunction.apply(1));
    }
    // Higher-order Function
    public static Function nTimes(Function function, int n) {
    if (n i;
    else
    return function.andThen(nTimes(function, n-1));
    }

  • @rheafernandeshallu
    @rheafernandeshallu 4 года назад +1

    This took a while to process. But good job on the video

    • @rockthejvm
      @rockthejvm  4 года назад

      Yep, this concept takes a bit to internalize.