Fun, fun, Funs?

Andy with Recycled Electrons <>
Thu Sep 28 04:44:43 CEST 2000


Hi...

I'm trying to write a procedure to map a fun down a list...

Can anyone tell me how this differs from the book?

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
215: f(Num, Mean) -> (Num - Mean)*(Num - Mean).
216:
217: Sub = fun f/1.
218: %
219:
220: getVariance(List)
221: %
222: %
223: 	->
224: 	sumList( lists:map(Sub, List) ).
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
I get errors:
./poedt.erl:217: syntax error before: Sub
./poedt.erl:224: variable 'Sub' is unbound
./poedt.erl:224: function sumList/1 undefined
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Sincerely, 

Andy Allen
Recycled Electrons
email: 





More information about the erlang-questions mailing list