Created
September 30, 2015 20:06
-
-
Save binarytemple/10c6af405d590dbd035f to your computer and use it in GitHub Desktop.
Flatmap in Erlang, substitute characters in a list
This file contains hidden or 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
| X = fun(Bin) -> | |
| list_to_binary( | |
| lists:flatmap( fun($&) -> "\\&"; ($\\) -> "\\\\"; (Chr) -> [Chr] end, binary_to_list(Bin)) | |
| ) | |
| end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment