OK, so I'm working on creating function representation for situations in SML:
type name = string type 'a fenv = name - & gt; 'A
I have stopped a bit about moving forward on this. The first thing I need to do is define a value of Fenvict. A 'Fend', which represents an empty environment (no name does not bind the environment). So far, I have this:
val fenvEmpty = funny blank (name) = ??? At the blank end
I'm not sure whether I'm on the right track or anything. What do I need to be free from the function? 0, empty or do not have to do any work.
Later, I have to type the function which gives data related to a particular name (a search function) in the environment, and a function that binds a special name (a tie function) in the environment. Data for, but I've already stuck on the fenvEmpty part.
type name = string type 'a fenv = name> - & gt; 'Exceptions the name of the unbound name, the funniest fenvEmpty name = increase the name of the unbound name
but I think before trying to use the version of fenv
For more ungraded variables, none
returns I believe this because, unlike exceptions, when writing the implementation you have a more type of structure for the program guided below (see below also). So, first try writing this implementation where fenv
is:
type 'a fenv = name - & gt; Now, for the post part of the question, you get a value
from name
in the current environment, the type of function Will be: val fenvAssoc: 'a fenv - & gt; Name - & gt; 'A - & gt; 'A Fend'
Note that the above result returns 'a fenv
. But remember that what is actually Fenw
is "just" a function:
type 'a fenv = name - & gt; 'A'
So, somehow missed the returned value, a function, somehow, "<"> name
and value
Should go with it How does the work normally remember the "things" in which they are "seen" in context, where they are defined?
To see the value of the name, you need a third function, which takes the current environment and returns a name and the value of that name, if any:
< Code> val fenvLookup: 'a fenv - & gt; Name - & gt; 'A
Again, remember what type of ' a fenv
is:
type 'a fenv = name - & gt; ; 'A'
I am pushing this because because you can apply to 'a fane'
, you basically either: A ) Can create a function or b) apply one.
No comments:
Post a Comment