Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

SML coding: Given: Define type 'a env as an abbreviation for a function type, and define exception NotFound, both as follows: type 'a env =

SML coding:
Given: Define type 'a env as an abbreviation for a function type, and define exception NotFound, both as follows:
type 'a env = string -> 'a
exception NotFound of string
Define these functions
val emptyEnv : 'a env = (* ... *)
val bindVar : string * 'a * 'a env -> 'a env = (* ... *)
val lookup : string * 'a env -> 'a = (* ... *)
such that you can use 'a env for a type environment or a value environment. On an attempt to look up an identifier that doesnt exist, raise the exception NotFound. Dont worry about efficiency.
Lastly define a function
val isBound : string * 'a env -> bool
that tells if a name is bound in the environment.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Databases With PostgreSQL From Novice To Professional

Authors: Richard Stones, Neil Matthew

2nd Edition

1590594789, 978-1590594780

More Books

Students also viewed these Databases questions

Question

What type of work-related team is presented in this case? Explain.

Answered: 1 week ago