-
-
Save wojtekmach/7d4b5dc2f45a4708ce04d19e7c381360 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@doc """ | |
The MapSet sigil. | |
iex> ~MapSet{1, 2, [3, 4], ~MapSet[5]} | |
#MapSet<[1, 2, #MapSet<[5]>, [3, 4]]> | |
# but this of course wouldn't work due to sigil delimiter escaping: | |
# iex> ~MapSet{1, ~MapSet{2}} | |
""" | |
defmacro sigil_MapSet({:<<>>, _, [string]}, []) do | |
quoted = Code.string_to_quoted!("[" <> string <> "]") | |
quote do | |
MapSet.new(unquote(quoted)) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment