133 lines
2.4 KiB
Plaintext
133 lines
2.4 KiB
Plaintext
=====================================
|
|
for / enumerable
|
|
=====================================
|
|
|
|
for n <- [1, 2], do: n * 2
|
|
|
|
---
|
|
|
|
(source
|
|
(call
|
|
(identifier)
|
|
(arguments
|
|
(binary_operator
|
|
(identifier)
|
|
(list
|
|
(integer)
|
|
(integer)))
|
|
(keywords
|
|
(pair
|
|
(keyword)
|
|
(binary_operator
|
|
(identifier)
|
|
(integer)))))))
|
|
|
|
=====================================
|
|
for / enumerable / with options and block
|
|
=====================================
|
|
|
|
for line <- IO.stream(), into: IO.stream() do
|
|
String.upcase(line)
|
|
end
|
|
|
|
---
|
|
|
|
(source
|
|
(call
|
|
(identifier)
|
|
(arguments
|
|
(binary_operator
|
|
(identifier)
|
|
(call
|
|
(dot
|
|
(alias)
|
|
(identifier))
|
|
(arguments)))
|
|
(keywords
|
|
(pair
|
|
(keyword)
|
|
(call
|
|
(dot
|
|
(alias)
|
|
(identifier))
|
|
(arguments)))))
|
|
(do_block
|
|
(call
|
|
(dot
|
|
(alias)
|
|
(identifier))
|
|
(arguments
|
|
(identifier))))))
|
|
|
|
=====================================
|
|
for / binary
|
|
=====================================
|
|
|
|
for <<c <- " hello world ">>, c != ?\s, into: "", do: <<c>>
|
|
|
|
---
|
|
|
|
(source
|
|
(call
|
|
(identifier)
|
|
(arguments
|
|
(bitstring
|
|
(binary_operator
|
|
(identifier)
|
|
(string
|
|
(quoted_content))))
|
|
(binary_operator
|
|
(identifier)
|
|
(char))
|
|
(keywords
|
|
(pair
|
|
(keyword)
|
|
(string))
|
|
(pair
|
|
(keyword)
|
|
(bitstring
|
|
(identifier)))))))
|
|
|
|
=====================================
|
|
for / reduce
|
|
=====================================
|
|
|
|
for x <- [1, 2, 1], reduce: %{} do
|
|
acc -> Map.update(acc, x, 1, & &1 + 1)
|
|
end
|
|
|
|
---
|
|
|
|
(source
|
|
(call
|
|
(identifier)
|
|
(arguments
|
|
(binary_operator
|
|
(identifier)
|
|
(list
|
|
(integer)
|
|
(integer)
|
|
(integer)))
|
|
(keywords
|
|
(pair
|
|
(keyword)
|
|
(map))))
|
|
(do_block
|
|
(stab_clause
|
|
(arguments
|
|
(identifier))
|
|
(body
|
|
(call
|
|
(dot
|
|
(alias)
|
|
(identifier))
|
|
(arguments
|
|
(identifier)
|
|
(identifier)
|
|
(integer)
|
|
(unary_operator
|
|
(binary_operator
|
|
(unary_operator
|
|
(integer))
|
|
(integer))))))))))
|