【发布时间】:2011-12-28 09:12:26
【问题描述】:
我正在尝试编写一些 Erlang 来过滤以下形式的数组:
[{dakota, "cold and snowy"}, {california, "perfect weather"}] % and so on
这就是我所拥有的 - 当我尝试从 werl 制作 .beam 时出现语法错误。
-module(matcher).
-export([findkeywords/2]).
findkeywords(Word, Arr) ->
IsMatch = fun({Key, Desc}) ->
lists:any(fun(X) -> X==Word end, string:tokens(Desc, " ")),
lists:filter(IsMatch, [{K, V} || {K, V} <- Arr]).
谁能发现我的语法有问题?
【问题讨论】:
标签: erlang