tailieunhanh - Foundations of F#.Net phần 10

Tham khảo tài liệu 'foundations of f#.net phần 10', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 294 CHAPTER 11 LANGUAGE-ORIENTED PROGRAMMING Listing 11-5. A Test Harness for Comparing light open printf input expression let input read_line printf Interpret Compile Compile Through Delegate i c cd let interpertFlag read_line printf reps let reps read_int type Df0 delegate of unit - float type Df1 delegate of float - float type Df2 delegate of float float - float type Df3 delegate of float float float - float type Df4 delegate of float float float float - float match interpertFlag with i - let lexbuf input let e lexbuf let args e let clock new Stopwatch for i 1 to reps do e args ignore printf Li c - let lexbuf input let e lexbuf let paramNames e let dm e paramNames let args paramNames let clock new Stopwatch for i 1 to reps do null args ignore printf Li cd - let lexbuf input let e lexbuf let paramNames e CHAPTER 11 LANGUAGE-ORIENTED PROGRAMMING 295 let dm e paramNames let args paramNames let args args fun f - f float let d match with 0 - type Df0 1 - type Df1 2 - type Df2 3 - type Df3 4 - type Df4 _ - failwith too many parameters let clock new Stopwatch for i 1 to reps do match d with Df0 as d - ignore Df1 as d - args. 0 ignore Df2 as d - args. 0 args. 1 ignore Df3 as d - args. 0 args. 1 args. 2 ignore Df4 as d - args. 0 args. 1 args. 2 args. 4 ignore _ - failwith too many parameters printf Li _ - failwith not an option Table 11-4 summarizes