illegal guard expression: filelib:is_dir(H)

Kay Kay kaykay.unique@REDACTED
Sun Feb 14 11:51:27 CET 2010

I have a function along the following lines

do_process_elements([],  _) ->   [];
do_process_elements([H | _], Fn) ->
     filelib:is_dir(H) ->
       process_directory(H, Fn);
     true ->
       process_file(H, Fn)

When I compile - I get the following error,  where the line number 
refers to    - filelib:is_dir(H) function.

./test.erl:23: illegal guard expression

Given that filelib:is_dir(H) returns true / false  - I thought this 
would fit in here as a predicate. What could be going wrong ?

More information about the erlang-questions mailing list