F# 基于模型的活动/注册管理
我有一项任务要完成。我将尽力提供描述的准确摘要 俱乐部有一个登记册,其中包含每个会员的姓名和描述。 名称是字符串,描述是元组(no,yb,ths)F# 基于模型的活动/注册管理,f#,f#-interactive,model-based-testing,F#,F# Interactive,Model Based Testing,我有一项任务要完成。我将尽力提供描述的准确摘要 俱乐部有一个登记册,其中包含每个会员的姓名和描述。 名称是字符串,描述是元组(no,yb,ths) 否=电话号码 yb=出生年份 -ths=感兴趣的主题 俱乐部安排由描述可能对该安排感兴趣的俱乐部成员的谓词给出。 即 P1(no,yb,ths)对于描述(no,yb,ths)为真 现在的目标是创建一个成员登记册,比如说三个成员,然后是一个安排 然后我应该创建一个函数,它给出了寄存器r中可能对该安排感兴趣的成员的姓名和电话号码列表 到目前为止,我已
- 否=电话号码
- yb=出生年份 -ths=感兴趣的主题
/// Club for employees
/// Register containing = names, and describtions. All names a unique.
/// The description is a tuple
/// (no,yb,ths) = no => Telefone number, yb = year of birth, ths is the themes of interests.
(*Exercise 1*)
type Name = string;;
type No = int;;
type Yb = int;;
type Ths = string;;
type Employee = (Name *(No*Yb*Ths)) list
type Arrangment = (No*Yb*Ths);;
(* Exercise 2*)
// Declaration of arrangement
// Declaration of register.
// Declaration of an arrangement p2.
let employee = [("John",(38804016,1982,["Soccer";"jazz"]));
("Rebecca",(20660416,1990,["Rugby";"Techno"]));
("Mogens",(93989832,1958,["Jazz";"Spa"]))];;
let p1 = [(1,1982,["Soccer";"Jazz")];;
let p2 = [(2,1990,"Soccer")];;
let rec findPersons p = function
|(p', adesc)::_ when p = p' -> adesc
|_::employee -> findPersons p
|_-> failwith(ac + " No matching acitivities")
我认为Ths应该是
类型Ths=字符串列表
。此外,不确定利益安排或清单应如何包括电话号码和DOB。也许它应该是类型排列=Ths
?