Created
April 5, 2012 20:09
-
-
Save rebcabin/2313720 to your computer and use it in GitHub Desktop.
Much better quoting
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
SetAttributes[captive2, HoldAllComplete]; | |
captive2[expr_ /; NumberQ @ Unevaluated @ expr] := number2[ToString[expr]] | |
captive2[expr_ /; (Head @ Unevaluated @ expr === Symbol)] := symbol2[ToString @ Unevaluated @ expr] | |
captive2[expr_ /; (Head @ Unevaluated @ expr === String)] := string2["\"" <> expr <> "\""] | |
captive2[head_[args___]] := {captive2 @ head, captive2 /@ Unevaluated @ {args}} | |
captive2[x___] := Throw @ {x}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
an application of this facility appears in https://gist.github.com/2313759