- 追加された行はこの色です。
- 削除された行はこの色です。
*予定のみ [#d16f4ec7]
--
- 日時 :2006/6/19 (Mon)
- 場所 :名大 理学部1号館(多元数理科学研究科) 307室?
- 時刻 :18:00〜19:30
- 参加者:??名
- 話題 :
#comment
----
#contents
*Chapter 6. Exercise続き [#b24a5ea9]
**Exercise 1 [#x1f19ca3]
**Exercise 6 (小笠原) [#x9271744]
**Exercise 7 [#vde22fdd]
**Exercise 8 [#k7994cd4]
**Exercise 9 (けいご) [#k464fb78]
**Exercise 10 (末次)[#g3e08704]
次の型をもつ関数を定義せよ.
'a * ('b, 'c) sum -> ('a * 'b, 'a * 'c) sum
let f1 (x, y) =
match y with
Left n -> Left (x, n)
| Right n -> Right (x, n);;
('a, 'b) sum * ('c, 'd) sum -> (('a * 'c, 'b * 'd) sum, ('a * 'd, 'b * 'c) sum) sum
let f2 (x, y) =
match (x, y) with
(Left n, Left m) -> Left (Left (n, m))
| (Left n, Right m) -> Right (Left (n, m))
| (Right n, Left m) -> Right (Right (n, m))
| (Right n, Right m) -> Left (Right (n, m));;
('a -> 'b) * ('c -> 'b) -> ('a, 'c) sum -> 'b
let f3 (x, y) = function
Left m -> x m
| Right m -> y m;;
(('a, 'b) sum -> 'c) -> ('a -> 'c) * ('b -> 'c)
let f4 f = (fun x -> f(Left x), fun y -> f(Right y));;
('a -> 'b, 'a -> 'c) sum -> ('a -> ('b,'c) sum)
let f5 = function
Left l -> (fun x -> Left (l x))
| Right r -> (fun x -> Right (r x));;
ただし,
type ('a, 'b) sum = Left of 'a | Right of 'b;;
*Chapter 7. Exercise [#bfc07932]
**Exercise 1 [#oe649801]
**Exercise 2 [#u76c0a17]
**Exercise 3 [#fe92b783]
**Exercise 4 [#v6d2c968]
**Exercise 5 [#q5984fe9]
**Exercise 6 [#ke8a0983]
**Exercise 7 [#n2c3331e]