#!/usr/bin/perl
x @foo= 1..10;
x "@foo";
####
Objective Caml version 3.09.3
# module L = List;;
module L :
sig
val length : 'a list -> int
val hd : 'a list -> 'a
val tl : 'a list -> 'a list
val nth : 'a list -> int -> 'a
val rev : 'a list -> 'a list
val append : 'a list -> 'a list -> 'a list
val concat : 'a list list -> 'a list
(* ... bunch of functions removed here ... *)
val merge : ('a -> 'a -> int) -> 'a list -> 'a list -> 'a list
end
####
S Foo::Bar
####
# #use "tree.ml";;
module Tree :
sig
type 'a tree = {
node : 'a;
mutable parent : 'a tree option;
mutable children : 'a tree list;
}
val create : ?children:'a tree list -> ?parent:'a tree -> 'a -> 'a tree
val is_leaf : 'a tree -> bool
val is_root : 'a tree -> bool
val get_depth : 'a tree -> int
val add_child : 'a tree -> 'a tree -> unit
val add_sibling : 'a tree -> 'a tree -> unit
val child_count : 'a tree -> int
val get_child : 'a tree -> at:int -> 'a tree
val size : 'a tree -> int
val traverse : 'a tree -> ('a tree -> 'b) -> unit
val string_of_tree : ?buffer:int -> string tree -> string
val tree_of_string :
?node_converter:('a -> 'a) ->
line_parser:(string -> int * 'b tree) ->
source:in_channel -> tree_root:'b tree -> unit -> 'b tree
end
# print_string (
Tree.string_of_tree (Tree.create "root" ~children:[
Tree.create "1.0" ~children:[
Tree.create "1.1";
Tree.create "1.2";
Tree.create "1.3" ~children:[
Tree.create "1.3.1";
];
Tree.create "1.4";
];
])
);;
1.0
1.1
1.2
1.3
1.3.1
1.4
- : unit = ()
#