Help, newcomer in Elixir and practicing recursion. Building function index_of/1, delete_at/2 and dudop/1 with recursion

Hi everyone, I’m new to the forum and new in general to Elixir. I’m trying to pratice a little before entering to more complex stuff and I’m trying to build some Elixir functions from scrath with recursion, mainly 3 of them.


But to be honest I don’t know where to begin with any of them. It would be great if some of you guys could help me build this functions.

Thanks a lot ! :smiley:

Welcome. With all due respect, I think you need to do it yourself. I am sure you have read the tutorials, yet still balk at writing the first real function. However, this is the leap forward we all have to take, if we aspire to become a programmer.


Start with an even easier function: length/1. Write a recursive function that computes the length of a list. There is both a body recursive way to do it, and a tail recursive way to do it, see if you can do both. If you can, you’ll be well on your way to completing the other functions


One thing that helps me a lot when I was thinking about imperative algorithms using a functional is to view not only a recursive call as an imperative loop but also accumulator variables that you pass along on those calls as mutable loop variables.