- 102
- 879 369
Isaac Harris-Holt
United Kingdom
Приєднався 30 січ 2014
Subscribe for programming content and a British accent!
Learn recursion with Gleam
The first 500 people to use my link skl.sh/isaacharrisholt12241 will get a 1 month free trial of Skillshare!
Recursion is a difficult topic for people new to it, but it doesn't have to be! Let's take a tour of recursion... using Gleam! Stay tuned for a great recursion tutorial recursion tutorial recursion tutorial!
Resources:
Gleam playground: playground.gleam.run
gleam/list: hexdocs.pm/gleam_stdlib/gleam/list.html
This video is sponsored by Skillshare.
__________________________________________
Check out my other socials!
🎮 Discord ▶ discordapp.com/invite/bWrctJ7
🐦 Twitter ▶ IsaacHarrisHolt
🖥️ Portfolio ▶ ihh.dev
📝 Blog ▶ isaacharrisholt.com
__________________________________________
Timestamps:
00:00 - Introduction
00:53 - What is recursion?
01:52 - Replacing loops
03:01 - Returning from recursive functions
05:40 - Data structure functions
08:35 - Tail call optimisation
13:32 - Why you don't need recursion
#gleam #softwareengineer
Recursion is a difficult topic for people new to it, but it doesn't have to be! Let's take a tour of recursion... using Gleam! Stay tuned for a great recursion tutorial recursion tutorial recursion tutorial!
Resources:
Gleam playground: playground.gleam.run
gleam/list: hexdocs.pm/gleam_stdlib/gleam/list.html
This video is sponsored by Skillshare.
__________________________________________
Check out my other socials!
🎮 Discord ▶ discordapp.com/invite/bWrctJ7
🐦 Twitter ▶ IsaacHarrisHolt
🖥️ Portfolio ▶ ihh.dev
📝 Blog ▶ isaacharrisholt.com
__________________________________________
Timestamps:
00:00 - Introduction
00:53 - What is recursion?
01:52 - Replacing loops
03:01 - Returning from recursive functions
05:40 - Data structure functions
08:35 - Tail call optimisation
13:32 - Why you don't need recursion
#gleam #softwareengineer
Переглядів: 3 862
Відео
My favourite Gleam feature confuses people...
Переглядів 8 тис.Місяць тому
My favourite Gleam feature - use - is often misunderstood, and many people find it confusing. Let's take a look at how it works, how to use it, and when not to. Resources: Using use in Gleam: erikarow.land/notes/using-use-gleam Check out my other socials! 🎮 Discord ▶ discordapp.com/invite/bWrctJ7 🐦 Twitter ▶ IsaacHarrisHolt 🖥️ Portfolio ▶ ihh.dev 📝 Blog ▶ isaacharrisholt.com Timesta...
You don't need loops
Переглядів 14 тис.2 місяці тому
The first 500 people to use my link (skl.sh/isaacharrisholt11241) will get a 1 month free trial of Skillshare premium! Looping is a very common, and very useful, practice in software development. But do you need it, or are there other alternatives? Perhaps, better alternatives? Resources: Gleam's list module: hexdocs.pm/gleam_stdlib/gleam/list.html Errors as values are the future: ua-cam.com/vi...
Go Realtime in Gleam with Lustre Server Components
Переглядів 10 тис.2 місяці тому
Server components are a really cool way to create realtime experiences in Gleam. This video will walk you through how to use them to create them using Lustre. Thanks to CodeCrafters for sponsoring! Check them out: ihh.dev/codecrafters Check out the code: github.com/isaacharrisholt/youtube/tree/main/code/048-lustre-server-components See the deployed app: mon.ihh.dev Resources: Lustre: lustre.bui...
Polar for Impatient Devs
Переглядів 6 тис.4 місяці тому
Polar is an open source monetisation platform created specifically for developers, and they've just hit v1! Upvote Polar on Product Hunt: dub.sh/polarhunt Massive thank you to Polar for sponsoring this video! Resources: Polar: polar.sh Polar Docs: docs.polar.sh Polar GitHub: github.com/polarsource/polar Astro integration: github.com/polarsource/polar/tree/main/clients/packages/astro My Portfoli...
Gleam is not Rust
Переглядів 28 тис.4 місяці тому
Gleam is not Rust, and I'm sick of people comparing them. Here's why they're different. Join the Discord! discordapp.com/invite/bWrctJ7 Follow my ranting! IsaacHarrisHolt Resources: Gleam: gleam.run Rust: rust-lang.org All you need is data and functions: mckayla.blog/posts/all-you-need-is-data-and-functions.html Check out my other socials! 🎮 Discord ▶ discordapp.com/invite/bWrctJ7 🐦...
How to Deploy Gleam Apps Anywhere
Переглядів 7 тис.4 місяці тому
Deploying Gleam is fairly simple, but it's not obvious how to do it at first glance. This video will cover how to deploy your apps locally, regionally and globally! Get yourself a ZimaBoard: ihh.dev/zima International links: ZimaBoard Official Shop: bit.ly/4cfqN3A ZimaBoard Media Server: bit.ly/3YwVwpr ZimaBoard on Amazon: amzn.to/3YCBzOh Check out the code: github.com/isaacharrisholt/youtube/t...
Slash Lustre Load Times with Server Side Rendering
Переглядів 7 тис.5 місяців тому
Want to use server-side rendering (SSR) to speed up your Lustre apps? Here's how! Previous video: ua-cam.com/video/3kr4Ydx6GGU/v-deo.html Client-side rendering can be great, but it has some downsides when it comes to load times and SEO. This video will show you how to use SSR and hydration in Lustre while keeping your code clean. Check out the code: github.com/isaacharrisholt/youtube/tree/main/...
Errors as Values are the Future
Переглядів 43 тис.5 місяців тому
We've all been in situations where our code errors when we least expect it, blowing up our program and taking down production. It's natural, and totally normal! But it's also preventable. Here's how Gleam does errors better. Writer: Ben Peinhardt Check out my other socials! 🎮 Discord ▶ discordapp.com/invite/bWrctJ7 🐦 Twitter ▶ IsaacHarrisHolt 🖥️ Portfolio ▶ ihh.dev 📝 Blog ▶ isaachar...
Everything you need to know about FFI in Gleam
Переглядів 8 тис.6 місяців тому
Gleam is a great language, but sometimes you just need to access the underlying platform, be it JavaScript, Erlang or Elixir. This video will teach you just how to do that using the power of foreign function interfaces, or FFIs! Resources: Externals in Gleam: tour.gleam.run/externals gleam_javascript: hexdocs.pm/gleam_javascript/ gleam_erlang: hexdocs.pm/gleam_erlang/ Check out my other socials...
Create Robust Web Apps with Gleam and Lustre
Переглядів 41 тис.6 місяців тому
Software is becoming more type-safe, but web technologies are falling behind. TypeScript alleviates some of the JavaScript woes, but it's still not enough. So what do we do? In this video, I'll show you how to build a completely type-safe web app in Gleam using the Lustre framework. Thanks to CodeCrafters for sponsoring this video! Level up your coding skills: ihh.dev/codecrafters Check out the...
The Ultimate Guide to Gleam Concurrency
Переглядів 24 тис.7 місяців тому
Thanks to the Erlang BEAM VM, Gleam is a fantastic language for writing highly concurrent software. But how do you deal with concurrency in Gleam? This video will teach you everything you need to know! New to Gleam? Check out this video first: ua-cam.com/video/NyKIvWvr9kw/v-deo.html Resources: Gleam Erlang: hexdocs.pm/gleam_erlang Gleam OTP: hexdocs.pm/gleam_otp Gleam: gleam.run Learn OTP w/ Gl...
You might never need Pandas again...
Переглядів 7 тис.8 місяців тому
You might never need Pandas again...
Using Rust to write scalable Python APIs
Переглядів 15 тис.9 місяців тому
Using Rust to write scalable Python APIs
TypeScript for Impatient JavaScript Devs
Переглядів 1,5 тис.10 місяців тому
TypeScript for Impatient JavaScript Devs
The 5 Languages Making Python Code Faster
Переглядів 1,5 тис.10 місяців тому
The 5 Languages Making Python Code Faster
The Solution to Python Package Management is... Rust??
Переглядів 3,9 тис.11 місяців тому
The Solution to Python Package Management is... Rust??
How to Create Mobile Apps with Python: BeeWare Tutorial
Переглядів 22 тис.11 місяців тому
How to Create Mobile Apps with Python: BeeWare Tutorial
Use THIS Language to Speed Up Your Python Code
Переглядів 7 тис.Рік тому
Use THIS Language to Speed Up Your Python Code
Supabase E2E testing just got so much easier...
Переглядів 1,7 тис.Рік тому
Supabase E2E testing just got so much easier...
SIMPLIFY Your Python Code With The Facade Pattern
Переглядів 1,9 тис.Рік тому
SIMPLIFY Your Python Code With The Facade Pattern
I Created A Free AI App To Teach You A Language
Переглядів 634Рік тому
I Created A Free AI App To Teach You A Language
Dataclasses From Scratch in Python - Class Decorators
Переглядів 744Рік тому
Dataclasses From Scratch in Python - Class Decorators
6:29 I think that should be "if (!HUNGRY)", not "if (HUNGRY)".
You're right, thank you!
As a Rust user, I have to agree the "rewrite it in Rust" movement was definitely a mistake. I think what a lot of people don't understand is that coding languages are entirely situational by definition, as a coding language is just a specific interpretation of abstraction of machine code. Sure, a language like C is technically "general purpose," but how many people are making LLM's in C? How many do you think are writing embedded firmware (not counting the RPi Pico) or system drivers in Python? You know? Rust is great for a lot of reasons, but it's not an end-all-be-all. Nothing really is.
This is a great take. These days we're also seeing more and more specialist programming languages and fewer "general purpose" ones, and I think that's fine! Alternatively, we see languages like Gleam which can compile to different backends depending on the use case you're targeting.
How does gleam, make you not use a cache store nd a message queue 😅 Huh
I demonstrated the cache in the video, and as for the message queue, concurrency in Gleam is often handled using actors, which have a mailbox that acts as a queue, processing a single message at a time! It's quite easy to build systems on top of that to replicate fanout queues and so on too. In fact, RabbitMQ, one of the most popular messages brokers, is built on the same virtual machine Gleam uses!
sorrybut7minutesistoolongtolistentosomeonetalkingwithnobreakssinbetweensentencesyouwouldnttalklikethisinpersonsowhydoithere
How do you get the assets?
What do you mean?
4:13 - while it's not necessarily going to have a huge impact on the image size, it's good hygiene to use a disposable builder image, do any kind of prep work you need there, and then use COPY to copy anything you need to your final image. It means you don't end up with useless layers and the possibility of leaking credentials (if you need to hit some artifact repository that expects credentials, for instance) is greatly reduced.
You're right, thanks!
take a shot every time he says type.
Bet
Good. I'm sick of numpties over complicating the simplest tasks. The ecosystem is such a mess nowadays.
There's certainly a lot going on! It seems that a lot of the major frameworks are converging on the same ideas though, which is nice
No mention of Elixir ?
Elixir is great! But I like my types 😁
Another new language...
Another great new language!
very elpful
Glad you found it useful!
The simplicity and readability is truly unmatched. I can't imagine Rust, Haskell or C++ being taught in only 7 minutes
True! I like simple languages
Clojure has wonderful loop/recur construct, which is really beautiful in my opinion because it looks like a loop but behaves functionally without need of tail call elimination.
What do you mean it doesn't need tail call elimination? I've not used Clojure at all, so I'm curious what this would look like
5:07 this is wrong, you can use function anywhere a statement or expression is allowed, not only at top level
You're right, thank you!
Nothing is better than Go for backend. 1. Everything you need is in the std library 2. Syntax is dead simple. 3. Concurrency is dead simple. 4. I’ve never written cache handler longer than 50 lines of code in Go. Having the cache as a separate process (ie redis) provides a fault tolerant system.
Go is great! I agree with your first three points for sure. On the last one, with the BEAM, your cache can be a separate process, or even on a separate node, but still be in your program, and still be perfectly fault tolerant!
great vid! your github link in the description is broken
Might be a weird question, but what font are you using?
JetBrains Mono
Assembly all the way 🎉
Uhhhhh good luck good luck
great work, i wonder what you think about if else
I have no strong opinions really. It's useful in some cases, but in others it's unnecessary indentation
"Write a recursive function without having to think too hard about stack overflow" seems to be something where Haskell has a big advantage over Gleam. The naive list-doubling function works just fine with lazy evaluation
Yeah, that'd be nice. Unfortunately it's difficult in Gleam as it doesn't have its own runtime, and instead relies on the runtimes it compiles to for most optimisations, especially runtime ones.
is that what people feel when i tell them that lifetimes in rust are good actually ._. i don't really get why would you sacrifice both performance and understandability and simplicity (except when you are walking through a branching structure) for purity
You're not sacrificing performance though. As I said, tail call optimised recursive functions get compiled down to tight loops, so they perform exactly the same.
Thank you, Awesome video!
Glad you found it useful!
I’m still trying to understand why such functional language is something needed ? To me it seem a bit complicated
Gleam is actually a lot simpler than an object oriented language! There's a lot less to learn and a lot less going on. It's merely a matter of what you're used to
when an app opens in light mode
😂
Awesome video, I'd like to request a video on decoding nested json in gleam using the zero api
Definitely got a JSON video planned!
Goodbye for loop hello out of memory xD
Someone didn't watch all the way to the end before commenting 👀
@@IsaacHarrisHolt I actually did, this was more of a shared experience ;) I actually liked the video a lot, keep more of these coming!
Delete emacs
Yes
next: higher order function, currying, folding, and partial application
Gleam doesn't support currying or partial application (at least, not in a generalised way). Higher order functions are a big part of any functional language, but I'm not sure how much of a video I could do on them 😅
@@IsaacHarrisHoltI would find it super valuable if you did a video reviewing gleam code and showing how it could be simplified using the standard library. plenty of higher order functions there
@@IsaacHarrisHolt Whatever you call it, the quick "let add_one = add(1, _)" type of function is a lovely way of doing what I think of when I think of partials
Just on my phone (pixel 6a) but the white balance seems quite white imo at 0:29
It 100% is way too exposed 😅
That's such a great tutorial! A quick question, umm instead of toga thing can we use simple html,css,js for frontend and flask for backend and wrap the entire thing with briefcase??
Unlikely - html and CSS don't really translate well to mobile unless you're making a progressive web app. You could use Flask for an API backend though
Gleam is not Rust Elixir is not Ruby
Someone gets it
The first 500 people to use my link skl.sh/isaacharrisholt12241 will get a 1 month free trial of Skillshare! Yes, I know I'm overexposed. New camera, working on it!
Angelic
The type safety myth... I'd love to know who these people are who need to stop themselves assigning a string to the variable `number`. Do you know what happens to python programmers who don't use type hinting? Nothing. Because mixing up types is either a sign of gross incompetence or, far more likely, the monster lurking in the child's cupboard. You know, there one that isn't there. If you're doing it for performance - that's perfectly valid, all power to you. If you're doing it as a crutch because you think you need your hand held - you almost certainly don't. Take those stabilisers off and just ride your bike like an adult.
This is definitely one of the comments of all time. You come across as though you've never worked on a large project with many developers. When writing software in teams, the best thing you can do is get the computer to do as much of the work for you as possible (auto formatting, lint checks, automated testing, etc.). Type checking is part of that - it reduces the mental load on each engineer, increasing the development velocity of the team as a whole. If you're relying on variable names to tell you their types, e.g. "number", you're basically introducing your own weak, inconsistent version of static typing anyway and creating more work for the people writing code and the people reviewing code. There are cases where dynamic typing is helpful, for sure, but for the work that 90% of people are doing, having static types is going to be a boon purely for the time it saves debugging issues. As much as anything else, static typing is a form of documentation. When you're onboarding new engineers onto a project, having types for them to read makes parsing the codebase infinitely easier - they don't have to keep all the context of all the types of every possible permutation of variables in their head to understand the flow of what's going on. And if you try to make the argument for documenting types in docstrings etc., again, you're using a poor-man's static typing. On the Python point, as someone who has written a fair bit of Python professionally, and used to make Python videos on this very UA-cam channel, a lot of the industry is moving towards using type hints as much as possible. The same trend can be seen in other popular dynamically typed languages - Elixir is getting a type checker built into the compiler, and Ruby's Sorbet is growing in adoption. Basically, all this to say... what??
I see. You're a proponent of the bloat approach. You're in a team so pile on the boilerplate and layer on the comments. "We can't take the stabilisers off the bike dad, it'll fall over." Let's agree to differ on that front.
Type annotations aren't bloat. Having to do more typing to make your life and your colleagues' loves easier is always worth it. Typing isn't your main job as a software engineer anyway.
@@IsaacHarrisHolt They literally are boilerplate. Listen, we clearly have very different ideas of what constitutes good code. You're the the verbose / explicit camp, I'm in the minimalist. Some experienced coders would agree with you and competent coders would agree with me. :)
@@davidmurphy563 you're very difficult to have a constructive conversation with, by god.
We have 20 concurrent languages. This is stupid. We should create one that fixes all these issues as a one stop solution. Now we have 21 concurrent languages. This is this video.
Gleam isn't a new concurrency system, it builds on Erlang!
I had the original Dark Core RGB and it was honestly the worst mouse I've ever owned. First and only Corsair product I've ever been disappointed in. My biggest complaint was battery life. It would go dead just sitting with the power switched turned off and I never got more than a half hour or so of gameplay out of it or the replacement. I also regularly got oddball multi-clicks or clicks not registering at all.
Interesting! I still have (and use!) the exact same mouse I showed in the video, and I've never had that issue. Perhaps you had a faulty unit? It does happen, sadly
Before this vid I thought my analogies were inane, but you sir take the cake with ease.
How kind, thank you :)
Wait a minute, what kind of nighttime activities do you have where you use a hammer and a corkscrew at the same time?
Uhhh... drunken woodworking?
@IsaacHarrisHolt that is an activity xD
I have used Laravel's ORM and QuerryBuilder (PHP), both are very intuitive.
I really dont like the idea of writing html using function composition
How come?
@IsaacHarrisHolt I think it just looks off and includes a lot of visual noise like a lot of brackets (often semantically useles ones like [], if an element has no atributes) the html. prefix (or you have to import the functions you use) etc. I really just like looking at actual HTML way more.
That's fair, but I don't think it's enough of a reason not to try Lustre. It's pretty great, and you get used to the syntax very quickly
@@IsaacHarrisHolt can you use lustre just on the Server. Because I want to try out htmx for the frontend
Absolutely!
I am sure what you are teaching is great, but CAN YOU SPEAK a little slower .... OK, I mean, can you speak A LOT SLOWER. For someone new like me, you talk waaaayyyy too fast
I've slowed down a lot in newer videos :)
Useless video, defer in go doesn't exist for code alignments sake and language features in general do not exist for code alignments sake. 2000 callbacks isn't better just because it isn't nested either.
I don't think I ever said defer existed for that reason, and like I showed, you can implement it perfectly fine without `use` in a functional language. `use` just makes things a lot nicer. And I dunno, being nested 2000 levels deep would be pretty gnarly. Even the tabs v spaces folks would gang up against you there! And lastly, this video is definitely not `use`less. Seems to me that there's quite a lot of `use`ful stuff happening here...
Errors were always values. Variables hold values, so everytime you catch a thrown exception it ends up in a variable that... holds a value. 🤯
Ah, pedantry. We are alike, you and I 😅
As much as I love Kotlin and the functional-ish approach of jetpack compose for UI the sheer amount of nested lambdas is a pain. Also love your videos on Gleam! Might give it a try for my next backend...
Thanks! Let me know how you get on
All this and not a single mention of the M-word. Video went a little fast for this Gleam sub-novice, but the use of use seems to resemble Scala's for comprehension construct. Is this an accurate comparison or is this something totally different?
You could possibly use it in a similar way, but `use` is a lot more general than that
It's great in a couple of cases, but I expected some disadvantages to be mentioned. This messes up semantics that care about what function scope they are in (meaning of return, break, etc. changes). Also because the rest of the function body gets swallowed, it does not look this elegant when you need some expressions beyond callback scope (have to surround use expr in another block).
Well it's a good job Gleam doesn't have returns or loops to break out of then! And if you need things behind the function scope, you'd either a) not use `use` or b) pull your `use` usage out into a function. While you can use a block to change the scope, you're right in that it's pretty pointless
@@IsaacHarrisHolt I admit it is a great sugar for languages that rely heavily on callbacks. Use is great because it does not propagate to the function's caller (like with async/await syntax). Great video, as usual.
Thank you :)
Nice
Thanks!
I will complain that recursion leads to unknown max stack size. If you do something like a depth-first search iteratively you have more control both over the max depth and handling the case when it is reached.
If you use tail call recursion, and your language supports it, your stack size won't increase.
Isnt there one too many parentheses after the "zorua" at 1:43 ?
You're right!