What does || mean in Erlang? -


i found there || in list manipulation. || mean? there examples ||?

lists:sum([a*b || {a, b} <- foo]). 

it used in list comprehensions. list comprehensions shorter way create lists without having use funs, maps or filters.

from programming erlang:

if have list l:

l = [1,2,3,4,5]. 

and want double every element, can do:

lists:map(fun(x) -> 2*x end, l). 

but list comprehensions can do:

[2*x || x <- l]. 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -