What do “schema” and “metacharacter” mean in F # expressions?

I am working on a tutorial in F # and after introducing the factorial function

let rec fact = function | 0 -> 1 | n-> n * fact(n-1);; 

the authors also note that the evaluation of an expression containing fact may not be completed and add to the footnote

Note that text of type fact n is not part of F #. This is a scheme in which you can get part of the program by replacing the metacharacter n with a suitable F # object.

It went right over my head! Although I am pleased with how fact works, and with recursion in other languages, I do not see the differences that the authors are trying to make here. Any explanation is appreciated.

+6
source share
1 answer

I suspect that whatever they are trying to say, n represents the value (ie, "F # entity") passed to the function. fact n must not be a valid F # code.

This is the legalese for " n is a placeholder."

+5
source

Source: https://habr.com/ru/post/953176/


All Articles