diff6-10.chapter4.txt

このページは最後に更新されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

last mod. 2008-08-28 (木) 09:51:44

diff6-10

105a106,110
>    Note that when you don't need an argument, you can still use a wildcard
> pattern, but you must prefix it with the label. 
> <<#h (fun ~x:_ ~y -> y+1);;
>   - : int = 3
> >>
258,260c263,265
<   To speak in an ``object-oriented'' way, one can consider that each function
< has a main argument, its object, and other arguments related with its action,
< the parameters. To permit the combination of functions through functionals in
---
>   To speak in an "object-oriented" way, one can consider that each function has
> a main argument, its object, and other arguments related with its action, the
> parameters. To permit the combination of functions through functionals in
292c297
<             |f:   |a function to be applied                      |
---
>             | f:  |a function to be applied                      |
319c324
< to be used with a unique type. On cannot use the same name in another type, or
---
> to be used with a unique type. One cannot use the same name in another type, or
327a333
> 
334c340
<   - : [> `Off | `On] list = [`On; `Off]
---
>   - : [> `Off | `On ] list = [`On; `Off]
337c343
<   - : [> `Number of int] = `Number 1
---
>   - : [> `Number of int ] = `Number 1
340c346
<   val f : [< `Number of int | `Off | `On] -> int = <fun>
---
>   val f : [< `Number of int | `Off | `On ] -> int = <fun>
358c364
<   type 'a vlist = [ `Cons of 'a * 'a vlist | `Nil]
---
>   type 'a vlist = [ `Cons of 'a * 'a vlist | `Nil ]
367a374
> 
374c381
<   val f : ([> `A | `B | `C | `D] as 'a) -> 'a = <fun>
---
>   val f : ([> `A | `B | `C | `D ] as 'a) -> 'a = <fun>
377c384
<   - : _[> `A | `B | `C | `D | `E] = `E
---
>   - : [> `A | `B | `C | `D | `E ] = `E
386,387c393,394
<   val f1 : [< `A of int | `B | `C] -> bool = <fun>
<   val f2 : [< `A of string | `B] -> bool = <fun>
---
>   val f1 : [< `A of int | `B | `C ] -> bool = <fun>
>   val f2 : [< `A of string | `B ] -> bool = <fun>
390c397
<   val f : [< `A of string & int | `B] -> bool = <fun>
---
>   val f : [< `A of string & int | `B ] -> bool = <fun>
402c409
<   type 'a wlist = [ `Cons of 'a * 'a wlist | `Nil | `Snoc of 'a wlist * 'a]
---
>   type 'a wlist = [ `Cons of 'a * 'a wlist | `Nil | `Snoc of 'a wlist * 'a ]
408c415
<   val open_vlist : 'a vlist -> [> 'a vlist] = <fun>
---
>   val open_vlist : 'a vlist -> [> 'a vlist ] = <fun>
411c418
<   - : [< `A | `B | `C] -> [ `A | `B | `C] = <fun>
---
>   - : [< `A | `B | `C ] -> [ `A | `B | `C ] = <fun>
420,421c427,428
<     [< `Cons of 'a | `Nil | `Snoc of 'b] ->
<     [> `A of [> `Cons of 'a | `Nil] | `B of [> `Snoc of 'b]] = <fun>
---
>     [< `Cons of 'a | `Nil | `Snoc of 'b ] ->
>     [> `A of [> `Cons of 'a | `Nil ] | `B of [> `Snoc of 'b ] ] = <fun>
430,432c437,439
<   val num : 'a -> [> `Num of 'a] = <fun>
<   val eval1 : 'a -> [ `Num of 'b] -> 'b = <fun>
<   val eval : [ `Num of 'a] -> 'a = <fun>
---
>   val num : 'a -> [> `Num of 'a ] = <fun>
>   val eval1 : 'a -> [< `Num of 'b ] -> 'b = <fun>
>   val eval : [< `Num of 'a ] -> 'a = <fun>
439,441c446,448
<   val plus : 'a -> 'b -> [> `Plus of 'a * 'b] = <fun>
<   val eval2 : ('a -> int) -> [< `Num of int | `Plus of 'a * 'a] -> int = <fun>
<   val eval : ([< `Num of int | `Plus of 'a * 'a] as 'a) -> int = <fun>
---
>   val plus : 'a -> 'b -> [> `Plus of 'a * 'b ] = <fun>
>   val eval2 : ('a -> int) -> [< `Num of int | `Plus of 'a * 'a ] -> int = <fun>
>   val eval : ([< `Num of int | `Plus of 'a * 'a ] as 'a) -> int = <fun>
452c459
<   val f : [< `Tag1 of int | `Tag2 of bool | `Tag3] -> string = <fun>
---
>   val f : [< `Tag1 of int | `Tag2 of bool | `Tag3 ] -> string = <fun>
456c463
<   val g1 : [< `Tag1 of 'a | `Tag2 of 'b] -> string = <fun>
---
>   val g1 : [< `Tag1 of 'a | `Tag2 of 'b ] -> string = <fun>
461c468
<   val g : [< `Tag1 of int | `Tag2 of bool | `Tag3] -> string = <fun>
---
>   val g : [< `Tag1 of int | `Tag2 of bool | `Tag3 ] -> string = <fun>
484c491
<   Beware also that certain idioms make trivial errors very hard to find. For
---
>   Beware also that some idioms make trivial errors very hard to find. For
488c495
<   type abc = [ `A | `B | `C]
---
>   type abc = [ `A | `B | `C ]
493c500
<   val f : [< `A | `As | `B | `C] -> string = <fun>
---
>   val f : [< `A | `As | `B | `C ] -> string = <fun>
502c509
<   Warning: this match case is unused.
---
>   Warning U: this match case is unused.

新規 編集 添付