[erlang-questions] du in Erlang as a first attempt at an application
Jarrod Roberson
jarrod@REDACTED
Thu Sep 20 02:49:46 CEST 2007
On 9/18/07, Joe Armstrong <erlang@REDACTED> wrote:
> 5 lines is a lot - should be one
>
> Hint
>
> Since you've got the book you could use lib_find (page 236,237)
> file_size_and_type page 233
> and a list comprehension or lists:map/2 and lists:sum/1
>
> You get another hint tomorrow if you've not solved it :-)
>
> /Joe Armstrong
thanks I asked a similar question on trapexit about
filelib:fold_files() about the parameters and someone suggested this.
Does everything in one line! Simpler than I thought.
filelib:fold_files(".", ".+", true, fun(F, A) ->
A+filelib:file_size(F) end, 0).
getting my head around functional programming after all these years of
OO is going to take some time. At least I have done list
comprehensions in Python :-)
More information about the erlang-questions
mailing list