Functional Programming - 19: Magma, Semigroup, Monoid demo

แชร์
ฝัง
  • เผยแพร่เมื่อ 14 ต.ค. 2024
  • Algebraic Structures are another set of useful tools we use in Functional Programming. In this video we will look at 3 basic structures in practice. We will also look at how to write Point Free functions.
    Magma is a Set of values with a binary operation that is closed on that Set.
    Semigroup is a Magma in which the binary operation is associative.
    Monoid is a Semigroup that has Empty or Neutral value.
    In this Video:
    Algebraic Structures
    Magma
    Semigroup
    Monoid
    Point Free style

ความคิดเห็น • 28

  • @vanikoakofashvili1524
    @vanikoakofashvili1524 ปีที่แล้ว +6

    I love this series; please don't stop recording the videos. (waiting for functors

    • @webvv
      @webvv  ปีที่แล้ว +2

      Thank you. I’m really glad you loved the videos so far. We’re getting pretty close to Functors, and I have good plans for it :)

  • @mistn
    @mistn ปีที่แล้ว +2

    This is awesome. A million thanks for carefully walking through through each concept.

    • @webvv
      @webvv  ปีที่แล้ว

      I’m glad you liked the videos so far

  • @senthilramalingam9500
    @senthilramalingam9500 ปีที่แล้ว +3

    Thank you so much brother for sharing such wonderful knowledge in an easy to understand way. Pls upload the rest of all the Categories...

    • @webvv
      @webvv  ปีที่แล้ว +1

      You’re welcome. You can see many Algebraic Structures outlined in here:
      en.wikipedia.org/wiki/Outline_of_algebraic_structures

  • @jessexing3456
    @jessexing3456 6 หลายเดือนก่อน +2

    awesome video!

  • @jpbastyr
    @jpbastyr ปีที่แล้ว +3

    love these videos, makes it a lot easier to understand these concepts with a demo in code. thanks!

    • @webvv
      @webvv  ปีที่แล้ว +1

      I’m glad you’re enjoying them.

  • @rhlcoder5802
    @rhlcoder5802 ปีที่แล้ว +1

    Your voice and way of teaching make it easy to follow along. Thank you, awesome content!

    • @webvv
      @webvv  ปีที่แล้ว

      I’m glad you think so! Thank you for following the videos.

  • @moustafaahmed7350
    @moustafaahmed7350 ปีที่แล้ว +1

    Excellent!! ❤❤

  • @dawid_dahl
    @dawid_dahl ปีที่แล้ว +1

    Great series, thanks so much!
    What do you think about the fp-ts library?

    • @webvv
      @webvv  ปีที่แล้ว +1

      Thank you Dawid, I’m glad you liked the series so far.
      I think Giulio work on fp-ts and his other projects has created a lot of awareness in the TypeScript community about Functional Programming. As you know TypeScript is pretty popular among Frontend engineers. All this awareness hopefully shows the language designers how much engineers want to have FP tools natively supported in TypeScript.

  • @LucasRodrigues-ju2pb
    @LucasRodrigues-ju2pb ปีที่แล้ว +1

    This channel is amazing! 👍

    • @webvv
      @webvv  ปีที่แล้ว

      That’s wonderful to hear :)

  • @antronixful
    @antronixful ปีที่แล้ว +1

    Excellent explanation. I've been working on implementing Quasigroups and Loops starting from Magma, but i've been having troubles to find any easy example of them outside substraction and division for integers and real numbers. Do you have any example you could give me at least for a string quasigroup?
    Quasigroups are magmas but with the notion of inverse (non associative and without identity)
    Loops are associative quasigroups.

    • @webvv
      @webvv  ปีที่แล้ว +2

      Thanks for your comment and interest in quasigroup! Honestly, I'm not familiar with it at the moment, but I'm always up for a good challenge and learning something new. I'll definitely look into quasigroup and maybe even make a video about it in the future. If you happen to have any good resources about quasigroup that you'd like to share, please feel free to add it here. Appreciate you bringing it to my attention!

    • @antronixful
      @antronixful ปีที่แล้ว +1

      @@webvv Well, there is the wikipedia article about algebraic structures and other dedicated to quasigroups and loops. Also, if you want to see details about the implementation in a programming language, haskell has two paths to construct a group: the main one, aka Magna → Semigroup → Monoid → Group, and the alternative one, aka Magma → Quasigroup → Loop → Group. The details in this alternative aren't the best, but for a rough implementation definition is alright.
      I know that you can construct a group even from another angle (Magma → Unital Magma→ Inverse Semigroup → Group), but for a personal project i would like to find at least some use case for quasigroups before.
      Appreciate the answer.

    • @webvv
      @webvv  ปีที่แล้ว

      That is pretty interesting. To what it’s worth I’m planning to talk about Group in the next video which is on the first path you mentioned. But I’ll look into Quasigroup to learn more about it. Thank you for mentioning this.

  • @rezajavid3593
    @rezajavid3593 ปีที่แล้ว +1

    ❤️❤️👍❤️❤️

  • @armenchik_dzhan
    @armenchik_dzhan ปีที่แล้ว

    It would be nice to replace all the cons(cons(cons... with more elegant function which creates linked list

    • @webvv
      @webvv  ปีที่แล้ว +2

      You are correct it would be much cleaner! The reason I haven’t created a helper functions like “fromArray” is for teaching reasons.

  • @Danielo515
    @Danielo515 11 หลายเดือนก่อน

    What is the difference between Magma and semigroup again?

    • @webvv
      @webvv  10 หลายเดือนก่อน

      All Semigroups are Magma, but all Magmas are not Semigroup. Semigroup is Magma with an extra requirement that its combine (concat) operation is Associative. I’ve explained this in details in the previous video:
      th-cam.com/video/Vev5_wJDJig/w-d-xo.htmlsi=OFsyHx_ghI64LnZ2

    • @nathaaaaaa
      @nathaaaaaa หลายเดือนก่อน +1

      ​@@webvvaka addition and multiplication are semigroups; subtractions, divisions and str concat are regular magmas.
      Am I right?
      Thanks for your videos, very helpful for learning functional programming

    • @webvv
      @webvv  หลายเดือนก่อน

      I’m glad you like them. All true except String concat. String concatenation is a Semigroup.
      Pro + (gram + ing) = (Pro + gram) + ing

    • @nathaaaaaa
      @nathaaaaaa หลายเดือนก่อน

      @@webvv ohh I see, I was thinking on cases like
      pro + (gram + ming) != (ming + pro) + gram
      But I guess I didn't understand the association correctly at first