联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> Python编程Python编程

日期:2018-11-22 10:16

Arizona State University

CSE 340 – Fall 2018

Homework 5

Due Wednesday November 21 by 11:59 PM

For each of the following definitions, give the type of the function and its arguments. If there is a type

mismatch, you should explain the reason for the mismatch. Note that for recursive functions, let rec

is used.

a. let f a = 1.1:

b. let f a = a 1

c. let f a b = a.(b) + 1.0

d. let f a b = a.(b) + b + 1.0

e. let f a b c = c.(a+b)

f. let f a b = a b

g. let f a b = a b + b a

h. let f a b = a (b (a))

i. let f a b c = c.(a+b) + a

j. let f a b c = if c.(a) > c.(b) then a else b

k. let f a b c = if c.(a.(b)) then a else b

l. let f a b c = a.(c) <= b +1

m. let rec max l = match l with

| [] -> raise Emptylist (* empty list exception *)

| h::[] -> h (* one element list *)

| h::t -> if h > (max t) then (* more than 1 element *)

h

else

(max t)

n. let f a b = if a b then a else b

o. let rec f a g = if a = 0 then 1 else g (f (a-1) g ) a

for what function g does the function f computes the factorial of a?

Define the function g


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp