Our Developing With Elixir/OTP course is on sale for only $49 through Friday, June 22, 2018! (Use coupon code “elixir49”.)
As we build an HTTP web server in this course from the ground up, we explore a number of real-world scenarios. One such example is recursion.
Recursion makes Elixir go ‘round and ‘round, and you’ve no doubt seen simple examples. But what about real-world use cases of recursion?
In our app, we need to parse the HTTP headers in POST requests. We want to transform a POST request like so…
request = """ POST /bears HTTP/1.1 Host: example.com User-Agent: ExampleBrowser/1.0 Accept: */* Content-Type: application/x-www-form-urlencoded Content-Length: 22 name=Baloo&color=Brown """
…into an Elixir struct like this:
Recursion is the perfect tool for this job! And while Elixir has convenience functions that often let you sidestep using recursion directly, Elixir pros know how to use recursion to their advantage.
For the next 24 hours, you can watch this 13-minute video for free:
The full Developing With Elixir/OTP course includes:
- 6.5 hours of step-by-step live coding
- 15 animations that break down advanced concepts
- 35 videos streamable and downloadable
- 56 hands-on exercises with all the solutions, of course
- Never-ending access (no monthly subscription!)