1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
WINSTONCH [101]
3 years ago
5

Write a function match that takes a valu * pattern and returns a (string * valu) list option, namely NONE if the pattern does no

t match and SOME lst where lst is the list of bindings if it does. Note that if the value matches but the pattern has no patterns of the form VariableP s, then the result is SOME []. Hints: Sample solution has one case expression with 7 branches. The branch for tuples uses all_answers and ListPair.zip. Sample solution is 13 lines. Remember to look above for the rules for what patterns match what values, and what bindings they produce. These are hints: We are not requiring all_answers and ListPair.zip here, but they make it easier.
Computers and Technology
1 answer:
yan [13]3 years ago
5 0

Answer:

Check the explanation

Explanation:

fun match (v,p)   =

    case (v,p) of  

     (_,Wildcard) => SOME []

    |(Const v1,ConstP p1) =>if v1 = p1 then SOME [] else NONE

    |(Unit,UnitP) =>SOME []

    |(Constructor (s ,v1),ConstructorP (s1, p1) ) => if s = s1 then match(v1,p1) else NONE

    |(Tuple vs,TupleP ps) => if List.length vs = List.length ps  

                             then case all_answers match (ListPair.zip(vs,ps))  of

                                   SOME v2=>SOME v2

                                  |_ => NONE

                             else NONE

    |(_, Variable s ) => SOME [(s,v)]

    |(_,_) => NONE

You might be interested in
How is a digital representation of analog data a form of abstraction? Why is the quality of the photo, music, etc better when mo
Alex

Answer:

1. This is because non-essential parts of the analog data is cut of so as to represent the analog data digitally.

2. This is because it mirrors closely to the original analog material.

3. i. Temperature ii. Speed ii. Distance iv. Electric current

Explanation:

1. How is a digital representation of analog data a form of abstraction?

Digital representation of analog data is a form of abstraction because, since abstraction, which is the removal of non-essential parts of a material so as to reduce complexity, also non-essential parts of the analog data is cut of so as to represent the analog data digitally.

2.Why is the quality of the photo, music, etc better when more samples are taken?

The quality of these items is better because, as more samples are taken, it reduces the error in the sampling and the item(photo, music etc) mirrors closely to the original analog material.

3. What other examples of analog data can you think of?

i. Temperature ii. Speed ii. Distance iv. Electric current

7 0
3 years ago
Earthquakes happen in the Earth’s
Nostrana [21]
Earthquakes happen in the Earths "CRUST" because all of the tetonical plates are located in the crust.

hope this helped
5 0
3 years ago
What is the different between 32bit anf 64 bit verision​
Elina [12.6K]

<u>The different between 32 bit and 64 bit version:​</u>

  • The main difference between 32-bit and 64-bit versions is that a 32-bit version can access 2^3^2 memory addresses which is roughly equivalent to 4 GB of memory.
  • On the other hand, a 64-bit version can access 2^6^4 memory addresses which equates to a huge amount of memory, 16 exabytes to be precise.  
  • Nowadays, we observe that almost all the computers have 64-bit processors, which means that they can access any amount of memory over 4 GB till 16 exabytes.
  • 64-bit processors have various advantages like the increased speed of operations, smooth multitasking and they can also support video games and software's that have high graphical requirements.
8 0
3 years ago
What is a browser? Give one example
Harman [31]
It is a program that may be used by a user to access files and navigate the World Wide Web. An example of this would be Firefox, Chrome, Safari, etc.
3 0
2 years ago
Read 2 more answers
A review of the sales, costs, and profit projections for anew product to find out whether these factors satisfy the company'sobj
soldier1979 [14.2K]

Answer: Business analysis

Explanation:

Business analysis is the review of the sales, costs, and profit projections for a new product to find out whether these factors satisfy the company's objectives.

Based on the business analysis a company is able to set a marketing strategy for a better promotion of its products. So this step is particularly very important.

7 0
3 years ago
Other questions:
  • One main advantage of CD-ROMs is that..
    7·1 answer
  • Processing is handled by the computer’s central processing unit (cpu).​ <br> a. True <br> b. False
    6·1 answer
  • Is it more beneficial to have many folders or is it better to " nest subfolders? Explain your response
    5·1 answer
  • Which is the correct formula to add the values in cells A1 and B1?
    11·2 answers
  • What are the features of Cobol language that make it suitable for programming business applications.
    6·1 answer
  • Which option nukes your systemâall apps, programs, user files, user settingsâand presents a fresh installation of Windows?
    13·1 answer
  • A(n) _________ is a computer system which is part of a larger system which performs a dedicated function.
    8·1 answer
  • Pleasee help. How do you fix this problem in discord?
    10·1 answer
  • PLEASEEEEEE HELP, ILL DO ANYTHING JUST ANSWER THESE CORRECTLY!!!!!TYSM!!!
    15·2 answers
  • Assume that Publication is the root class of an inheritance tree. You want to form a linked list of different publications in th
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!