Created
January 15, 2015 15:10
-
-
Save stdray/ff84091ad8f9cc575c78 to your computer and use it in GitHub Desktop.
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
| using Nemerle.Collections; | |
| using Nemerle.Text; | |
| using Nemerle.Utility; | |
| using System; | |
| using System.Collections.Generic; | |
| using System.Console; | |
| using System.Linq; | |
| module Program | |
| { | |
| Main() : void | |
| { | |
| PrintTypeString(typeof(List[Dictionary[int, _]])); | |
| _ = ReadLine(); | |
| } | |
| TypeString(type : Type) : string | |
| { | |
| if(type.IsArray) | |
| { | |
| def et = type.GetElementType(); | |
| $"array[$(TypeString(et))]" | |
| } | |
| else if(type.GenericTypeArguments.Length > 0) | |
| { | |
| def argsStr = string.Join(", ", type.GenericTypeArguments.Map(TypeString)); | |
| $"$(type.Name)[$argsStr]" | |
| } | |
| else type.Name | |
| } | |
| PrintTypeString(type : Type) : void | |
| { | |
| Console.WriteLine(TypeString(type)) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment