Skip to content

Commit 633716c

Browse files
committed
Show how operators can be captured, closes elixir-lang#1576
1 parent 730773d commit 633716c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

getting-started/modules-and-functions.markdown

+9
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,15 @@ iex> (&is_function/1).(fun)
167167
true
168168
```
169169

170+
You can also capture operators:
171+
172+
```elixir
173+
iex> add = &+/2
174+
&:erlang.+/2
175+
iex> add.(1, 2)
176+
3
177+
```
178+
170179
Note the capture syntax can also be used as a shortcut for creating functions:
171180

172181
```elixir

0 commit comments

Comments
 (0)