Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

F# Functions slides: https:/bviewer jupyter.org/github/wildart/CSC1364/blob/master/F%23%20Programming 20-4-20Functions.pynb 01. For each of the following definitions, say whether it is a simple value or a function and if

image text in transcribed
image text in transcribed
F# Functions slides: https:/bviewer jupyter.org/github/wildart/CSC1364/blob/master/F%23%20Programming 20-4-20Functions.pynb 01. For each of the following definitions, say whether it is a simple value or a function and if a function, what is the function signature? fin doubt run them in the interactive Tool to find out let testA-2 let testBX-2 + x let test x - 2.0 + X let test - "hello" let teste printin "hello let test() = 42 let test () - printfn "hello" let testHx = String length x let testixsprintfix let test x-printinx let testkx-printin xis xx return x let testi fint -> string) x fx let testM f cint) string - fx let testNx:string-xt hint: what does string modify? let testo - 1 let testPX-X1 hint: what kind of thing is x? let testoxy let testRxyz-Z let tests x-X-X let testTff1) + 2 let testUf-sprintf f1) let testvf ) + 2 let test x-fun y-yox let testxxy-yox let testy - fun xy-y*x let test fx (f1) + x Submit type signatures for the every expression. Q2. For each of the following signatures, create a function that will be inferred to have that signature. Avoid using explicit type annotations! val SigA-int->int val sig - intunit val sigC = int> string valsig -unit-> string val sige = string -> string val sigF = int> bool-> float> string val sigG = int> yint -> int II 2 different implementation styles, please val sigH = xint-> (int->int) I Hint: define a nested function val sigi = f[int->int)->int valsig - cint-yoint> zint-> int val sigk=f(int->int) -> (int->int) val sigl = cint -> f[int->int) -> int val sigM - f[int->int->int) -> int val sigN-xint-> ('a -> int) Submit function definitions for the every type signature

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

Professional SQL Server 2000 Database Design

Authors: Louis Davidson

1st Edition

1861004761, 978-1861004765

More Books

Students also viewed these Databases questions

Question

Determine a sensible structure for the dissertation AppendixLO1

Answered: 1 week ago

Question

57. Show that for any three events A, B, and C with P(C) 0,

Answered: 1 week ago

Question

6. Explain the strengths of a dialectical approach.

Answered: 1 week ago

Question

2. Discuss the types of messages that are communicated nonverbally.

Answered: 1 week ago