I’m trying to learn how to think in a functional programming way, for this, I’m trying to learn Erlang and solving easy problems from codingbat. I came with the common problem of comparing elements inside a list. For example, compare a value of the i-th position element with the value of the i+1-th position of the list. So, I have been thinking and searching how to do this in a functional way in Erlang (or any functional language).
Please, be gentle with me, I’m very newb in this functional world, but I want to learn
Thanks in advance
Define a list:
Define a function f, which takes a list
In Erlang code
Apply function
This should work… haven’t compiled and run it but it should get you started. Also in case you need to do modifications to it to behave differently.
Welcome to Erlang 😉