Alternative to enum.each to process a list

Newbie here
I am using enum.each to process a list and call a function.
I need to return a value other than :ok.
Whats the best alternative for enum.each

Thanks for the help and patience.


If you would like to return the transformed list, you can use[1, 2, 3], fn num ->
  num * 2

# [2, 4, 6]

the list is a list of files.
I need to slice out parts of the file names and return a map or list with info on the file names.

Thanks again

@bww00 I hope we’re not doing your homework for you :wink:

Is it a list of paths to files or the contents?

|> path ->
  |> do_something()

At least you didn’t ask for my lunch money!!
Last homework I had was 35 years ago.
This old dog is trying to learn some new tricks and what looks like a fantastic language.
Trying to ease into using elixir at work on a couple of small projects were sent my way.

Your help is much appreciated.

Regards and stay safe


It’s actually a list of files from a Sftp server

I managed t get sftp_ex working to get connected and a list of files.
Now I have to futz around with the list

Thanks again

Ha-ha - about the same. There’s a few of us old dogs here. I suspect higher than average for a “new-ish” language. and Enum.reduce are worth spending a bit of time getting your head around. If you want to dig into them I can recommend and the following chaper on higher order functions - it uses Erlang to explain the concepts, but it provides a good theoretical underpinning of how these work and how you can harness them.


Thanks again for your help