如果Pred(Elem)对List中的所有元素Elem返回true,则返回true,否则返回false。
all(Pred,lst)
Pred - 将应用于字符串的断言函数。
Lst - 值列表。
如果Pred(Elem)对List中的所有元素Elem返回true,则返回true,否则返回false。
-module(helloLearnfk). -import(lists,[all/2]). -export([start/0]). start() -> Lst1=[1,2,3], Predicate=fun(E) -> E rem 2 == 0 end, Status=all(Predicate, Lst1), io:fwrite("~w~n",[Status]).
当我们运行上述程序时,我们将得到以下输出。
链接:https://www.learnfk.comhttps://www.learnfk.com/erlang/erlang-all.html
来源:LearnFk无涯教程网
false
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)
Python实战 · 从0到1搭建直播视频平台 -〔Barry〕