简体   繁体   中英

Elixir/Erlang: Error when a variable list merge with many other lists

I have this function:

defp get_list(map, l, i) do

    list = l ++ map

where map is the new list who comes every repetition, so l is merged with it and attributed to list

it works great for a small number of pages, the problem is when lots of pages are being merged, some time after the lists are beind added to list the following error accurs:

(ArgumentError) argument error :erlang.++([0.33966522437570745,...]) (api_sort 0.1.0) lib/api_sort.ex:18: ApiSort.get_list/3

问题是来自站点的一些“地图”不是列表类型,即使它们都在 [] 之间,所以我创建了一个条件 is_list(map) 并防止这些虚假列表导致错误。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM