Created
April 7, 2010 21:04
-
-
Save DeMarko/359459 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
(* written by @chrisamaphone of chrisamaphone fame *) | |
val s_end = "\nval s_start = \"val s_end = \"\nfun quote #\"\\n\" = \"\\\\n\"\n\t| quote #\"\\\\\" = \"\\\\\\\\\"\n\t| quote c = Char.toString c\n\nfun q () = print (s_start ^ \"\\\"\" ^ (concat (map quote (explode s_end))) ^ \"\\\"\" ^ s_end)" | |
val s_start = "val s_end = " | |
fun quote #"\n" = "\\n" | |
| quote #"\\" = "\\\\" | |
| quote c = Char.toString c | |
fun q () = print (s_start ^ "\"" ^ (concat (map quote (explode s_end))) ^ "\"" ^ s_end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment