No video

Your code can be beautiful AND fast (Higher order functions)

  Рет қаралды 15,854

peppidesu

peppidesu

Күн бұрын

Пікірлер: 60
@SolathPrime
@SolathPrime Жыл бұрын
Haskell falls in a category of programming languages that makes you think about the code And forget that you actually have to code and I'm thankful for that take for example: ```hs Relu :: [float] -> [float] Relu x | x > 0 = x | otherwise = 0.0 let xs = [-2.0, -1.0, 0.0, 1.0, 2.0] main :: IO() main = putStrLn map Relu xs -- prints [0.0, 0.0, 0.0, 1.0, 2.0] ``` and suddenly machine learning was never that easy math was never that easy thinking about code instead of actually coding was never that easy oh I love haskell do I need to sleep? yes cause it's 2:19 AM and I have a work to do will I actually sleep? probably NO oh shit I'm ranting again
@peppidesu
@peppidesu Жыл бұрын
what about map (maximum 0.0) xs :)
@SolathPrime
@SolathPrime Жыл бұрын
@@peppidesu woah I've never thought of it I always look at the mathematical shape and forget the easy simple form of it
@zokalyx
@zokalyx Жыл бұрын
@@peppidesu do you mean max?
@SolathPrime
@SolathPrime Жыл бұрын
@@zokalyx in haskell the `max` function is called: `maximum`
@mattetis
@mattetis 7 ай бұрын
​@SolathPrime No, the correct implementation is `map (max 0.0) xs`. `max` compares two values and `maximum` folds a Foldable with `max`, i.e. `maximum xs` gets you the biggest value in the collection
@crckrbrrs
@crckrbrrs Жыл бұрын
your presentation is fucking beautiful, and i think its criminal that you only have 3k subs
@Yogesh-kr7bo
@Yogesh-kr7bo Жыл бұрын
yandere dev crying in the corner
@44mira
@44mira 11 ай бұрын
You are definitely one of the best channels for these types of presentations, they're very sleek, clean and informative. I was wondering if you could make a video on your workflow when it comes to making these videos? I have also been considering making a channel entirely around FP as I think it is quite the outstanding and fun approach to programming, and having a video creation process to base it on would be much appreciated!
@learning-og4to
@learning-og4to 2 ай бұрын
this channel is great. you explain these concepts very well
@TheGRoques
@TheGRoques 7 ай бұрын
Thank you. I've been thinking of starting Haskell for many years, and this video series serves as a concise and accessible introduction!
@Zetty
@Zetty Жыл бұрын
another banger from peppidesu
@kedislav_
@kedislav_ Жыл бұрын
so true bestie
@karl_zw
@karl_zw 10 ай бұрын
Your vidoes are amazing, please keep them coming!
@mtv.smorodin
@mtv.smorodin 8 ай бұрын
looking forward for next episodes! thank you for your content 🎉
@zokalyx
@zokalyx Жыл бұрын
I absolutely loved the building blocks graphics!
@maurolimaok
@maurolimaok 8 ай бұрын
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 6 ай бұрын
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
@harune6594
@harune6594 4 ай бұрын
oh man heartbroken you didnt continue this series
@SimGunther
@SimGunther Жыл бұрын
While map itself is embarrassingly parallel, there are tasks that are not "embarrassingly parallel" that would be better used for a work stealing scheduler that accounts for shared resources. There's a set of "embarrassingly sequential" problems such as dynamic programming (load balancing and 90% of leetcode questions) and state machines (tokenizers included) you'll have to keep in mind before blindly throwing a bunch of threads on a problem. Well aware that there's mapM for monadic mapping over a list along with parMapM for a parallel version of that listing, but make sure you solved the problem correctly single threaded or else you'll be in "big trouble in little CPU town: multi threaded edition."
@0LoneTech
@0LoneTech 6 ай бұрын
... KZfaq ate the two previous versions of this reply without warning, so pardon the duplicates if there are any. Work stealing is a particular example of a parallel load balancing algorithm, and tokenizers are usually easily parallelizable (typically neighbour aware map followed by partitioned reduce for longer tokens). Sometimes there's a specific choice, as in signature chains vs Merkle trees, but a lot of the time there's a perspective to be found that isn't obvious at first glance. As for parMapM, bear in mind that not all monads are IO. They are distinguished in Control.Monad.Par.
@Sk8erMorris
@Sk8erMorris 8 ай бұрын
Hope all is well, wondering for the continuation of the series :)
@callyral
@callyral 8 ай бұрын
oh, like rust iterators! haskell sounds pretty cool
@user-tx4wj7qk4t
@user-tx4wj7qk4t 6 ай бұрын
My understanding is that Rust took a lot of design decisions from Haskell and ML. How do the iterators work compared to this? I know the word iterator to mean something that allows you to iterate through a structure
@fabricehategekimana5350
@fabricehategekimana5350 Жыл бұрын
Incredible video ! I like your work and I hope the best for you
@posfr292
@posfr292 3 ай бұрын
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.
@SilverStarStorm.
@SilverStarStorm. 6 ай бұрын
Continuation when? :p
@dycan0716
@dycan0716 5 ай бұрын
Any tutorial about vizualisation in the new perspective section? looks sophisticated.
@GamingKing-jo9py
@GamingKing-jo9py Жыл бұрын
i've been known to make my code borderline unreadable to others because it saved one more variable (pointfree* is cool) i don't know why but now i find them ugly *mostly
@alexanderskusnov5119
@alexanderskusnov5119 4 ай бұрын
2:49 foo needs a function of one argument (type a), it's not a plus function of 2 arguments (x, y).
@kedislav_
@kedislav_ Жыл бұрын
beautiful code for a beautiful man
@adriansomor
@adriansomor 6 ай бұрын
amazing series
@zsuato
@zsuato 2 ай бұрын
this is so cool
@theaveasso
@theaveasso Жыл бұрын
Do you have any recommend open source that Haskell beginners can work on?
@user-zs6oh4wp1d
@user-zs6oh4wp1d 7 ай бұрын
Great video :D
@WayOfTheCode
@WayOfTheCode 7 ай бұрын
Amazing videos
@Treston-ri7of
@Treston-ri7of Жыл бұрын
A good use of showing anonymous functions to cybersec students, this is how you reel them from crow into the functional programming & math pipeline
@dootsi9452
@dootsi9452 Жыл бұрын
great video
@BashkaMen
@BashkaMen 9 ай бұрын
What is name of font?
@rutieltercero9355
@rutieltercero9355 4 ай бұрын
COME BAAAACK
@konstantinrebrov675
@konstantinrebrov675 9 ай бұрын
Is it possible to use higher order functions in C, C++, or Rust? Maybe with some clever ways of coding tricks?
@peppidesu
@peppidesu 9 ай бұрын
Rust features them out of the box with iterators and closures. I am not very familiar with C++, but it should have them in the standard library as well. As for C, you probably need to make them yourself. In general, if a language supports passing functions as arguments (spoiler: most of them do), you can use higher order functions!
@konstantinrebrov675
@konstantinrebrov675 9 ай бұрын
@@peppidesu I don't know how to make them in C.
@CarlBach-ol9zb
@CarlBach-ol9zb 9 ай бұрын
@@konstantinrebrov675, you can do it in C++, I think. C++11 and latter ones have lambda expressions. May not be as elegant as in Haskell or other Functional Programming languages. In C, you can pass functions to other functions via their pointers and dereference, but this will be kind of a bad practice, and it's limited.
@konstantinrebrov675
@konstantinrebrov675 9 ай бұрын
@@CarlBach-ol9zbOk
@aev6075
@aev6075 8 ай бұрын
It's pretty easy on C++. You can make lambdas and callback function with function pointers aswell.
@yash1152
@yash1152 Жыл бұрын
8:01 whatttt?
@flikkie72
@flikkie72 Жыл бұрын
Wow you sounds so, so similar to Rutger Bregman
@user-tx4wj7qk4t
@user-tx4wj7qk4t 6 ай бұрын
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
@cemgecgel4284
@cemgecgel4284 Жыл бұрын
I do not like Haskell's whitespace sensitive syntax. I would prefer a simple functional language with a simple C-like syntax.
@Yogesh-kr7bo
@Yogesh-kr7bo Жыл бұрын
It's just a syntatux sugar you can use the C-like syntax
@user-tx4wj7qk4t
@user-tx4wj7qk4t 6 ай бұрын
You can use brackets and semicolons. Nobody does because it's ugly
@0LoneTech
@0LoneTech 6 ай бұрын
Specifically this is discussed in the Haskell language report section 2.7 Layout: "Haskell permits the omission of the braces and semicolons used in several grammar productions, by using layout to convey the same information. This allows both layout-sensitive and layout-insensitive styles of coding, which can be freely mixed within one program. Because layout is not required, Haskell programs can be straightforwardly produced by other programs."
@sunofabeach9424
@sunofabeach9424 10 ай бұрын
cool. now write UI
@0LoneTech
@0LoneTech 6 ай бұрын
UI for what? Would you like it in Monomer, Brick, Reactive Banana, Grapefruit, Concur, Reflex...?
Recursion - To hone a skill, one must practice.
10:54
peppidesu
Рет қаралды 21 М.
Master Go Programming With These Concurrency Patterns (in 40 minutes)
46:15
а ты любишь париться?
00:41
KATYA KLON LIFE
Рет қаралды 3,6 МЛН
Prank vs Prank #shorts
00:28
Mr DegrEE
Рет қаралды 10 МЛН
How I Did The SELF BENDING Spoon 😱🥄 #shorts
00:19
Wian
Рет қаралды 37 МЛН
Dad Makes Daughter Clean Up Spilled Chips #shorts
00:16
Fabiosa Stories
Рет қаралды 2,3 МЛН
Haskell Tutorial: Calling REST APIs (HTTP requests using "wreq")
33:45
The Absolute Best Intro to Monads For Software Engineers
15:12
Studying With Alex
Рет қаралды 624 М.
Projects Every Programmer Should Try
16:58
ThePrimeTime
Рет қаралды 437 М.
Andrew Kelley   Practical Data Oriented Design (DoD)
46:40
ChimiChanga
Рет қаралды 87 М.
How Monoids are useful in Programming?
9:24
Tsoding
Рет қаралды 47 М.
How to read Haskell code (in 7 minutes)
6:51
peppidesu
Рет қаралды 59 М.
Premature Optimization
12:39
CodeAesthetic
Рет қаралды 795 М.
How principled coders outperform the competition
11:11
Coderized
Рет қаралды 1,6 МЛН
So You Think You Know C#? Delegates & Higher Order Functions
53:36
а ты любишь париться?
00:41
KATYA KLON LIFE
Рет қаралды 3,6 МЛН