lundi 13 avril 2015

How to get the name of function argument in F#?

Can I write a function which returns the name of the function given as the argument?



let funName f: string =
// returns the name of f.


For example, if I pass printfn as an argument to funName, it returns "printfn".



> funName printfn;;
val it : string = "printfn"





Aucun commentaire:

Enregistrer un commentaire