Ask Question
30 May, 19:26

1. If an F# function has type 'a - > 'b when 'a : comparison, which of the following is not a legal type for it? Select one:

A. (float - > float) - > bool

B. string - > (int - > int)

C. int - > int

D. int list - > bool list

+5
Answers (1)
  1. 30 May, 21:55
    0
    B. string - > (int - > int)

    Explanation:

    We are going to perform comparison operations '->'. It is important to notice that the comparison operation gives us a bool value (True or False) and the comparison operation is legal if and only if the data types to be compared are the same.

    Example:

    int (4) - >int (5) False

    int (4) - >int (4) True

    int (4) - >string (4) Error, data types don't match

    For this reason:

    A. Is legal because float - > float evaluates to True, True is a boolean value and bool - > bool is legal because both are the same data type. B. Is illegal because int - > int evaluates to True, True is a boolean value and string is not a boolean (string - > bool). C. Is legal because int is the same type than int. D. Is legal because the list is the same type than list regardless it's content.

    Note:

    The operations inside parentheses are evaluated first.

    List is a type by itself regardless of its content.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “1. If an F# function has type 'a - > 'b when 'a : comparison, which of the following is not a legal type for it? Select one: A. (float - > ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers