Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
29 lines (28 sloc) 881 Bytes
Obj.is_block (Obj.repr (1,2,3)) ;;
Obj.is_block (Obj.repr 1) ;;
#part 1
Obj.tag (Obj.repr 1.0) ;;
Obj.double_tag ;;
#part 2
Obj.double_tag ;;
Obj.double_array_tag ;;
#part 3
Obj.tag (Obj.repr [| 1.0; 2.0; 3.0 |]) ;;
Obj.tag (Obj.repr (1.0, 2.0, 3.0) ) ;;
Obj.double_field (Obj.repr [| 1.1; 2.2; 3.3 |]) 1 ;;
Obj.double_field (Obj.repr 1.234) 0 ;;
#part 4
type t = Apple | Orange | Pear ;;
((Obj.magic (Obj.repr Apple)) : int) ;;
((Obj.magic (Obj.repr Pear)) : int) ;;
Obj.is_block (Obj.repr Apple) ;;
#part 5
type t = Apple | Orange of int | Pear of string | Kiwi ;;
Obj.is_block (Obj.repr (Orange 1234)) ;;
Obj.tag (Obj.repr (Orange 1234)) ;;
Obj.tag (Obj.repr (Pear "xyz")) ;;
(Obj.magic (Obj.field (Obj.repr (Orange 1234)) 0) : int) ;;
(Obj.magic (Obj.field (Obj.repr (Pear "xyz")) 0) : string) ;;
#part 6
Pa_type_conv.hash_variant "Foo" ;;
(Obj.magic (Obj.repr `Foo) : int) ;;