diff options
author | octachron <octa@polychoron.fr> | 2015-11-26 19:21:25 +0200 |
---|---|---|
committer | octachron <octa@polychoron.fr> | 2015-11-29 10:55:12 +0200 |
commit | c1faf4d4d8d28a462dce0d2c53054773dbe26ba2 (patch) | |
tree | 5acade94eb0879cf8e735e7391aa48bc581173b4 | |
parent | 7a11de0c414e74a7742ea912166aab753354b014 (diff) | |
download | ocaml-c1faf4d4d8d28a462dce0d2c53054773dbe26ba2.tar.gz |
manual: distinguish bytes array and string
This small fix correct the use of the deprecated String.copy in the
manual. To be more coherent, it also mention briefly the existence of
bytes and the immutability of strings in the core language section.
-rw-r--r-- | manual/manual/tutorials/advexamples.etex | 6 | ||||
-rw-r--r-- | manual/manual/tutorials/coreexamples.etex | 16 |
2 files changed, 11 insertions, 11 deletions
diff --git a/manual/manual/tutorials/advexamples.etex b/manual/manual/tutorials/advexamples.etex index 8d3933224b..99a2f27fcc 100644 --- a/manual/manual/tutorials/advexamples.etex +++ b/manual/manual/tutorials/advexamples.etex @@ -315,7 +315,7 @@ class ostring s = object method get n = String.get s n method print = print_string s - method copy = new ostring (String.copy s) + method copy = new ostring s end;; \end{caml_example} However, the method "copy" returns an object of the class "ostring", @@ -338,7 +338,7 @@ class better_string s = val repr = s method get n = String.get repr n method print = print_string repr - method copy = {< repr = String.copy repr >} + method copy = {< repr = repr >} method sub start len = {< repr = String.sub s start len >} end;; \end{caml_example} @@ -357,7 +357,7 @@ class ostring s = method repr = repr method get n = String.get repr n method print = print_string repr - method copy = {< repr = String.copy repr >} + method copy = {< repr = repr >} method sub start len = {< repr = String.sub s start len >} method concat (t : 'mytype) = {< repr = repr ^ t#repr >} end;; diff --git a/manual/manual/tutorials/coreexamples.etex b/manual/manual/tutorials/coreexamples.etex index c61ebcb8b8..f2b8dbef20 100644 --- a/manual/manual/tutorials/coreexamples.etex +++ b/manual/manual/tutorials/coreexamples.etex @@ -54,20 +54,20 @@ fib 10;; \pdfsection{Data types} In addition to integers and floating-point numbers, OCaml offers the -usual basic data types: booleans, characters, and character strings. +usual basic data types: booleans, characters, and immutable character strings. \begin{caml_example} (1 < 2) = false;; 'a';; "Hello world";; \end{caml_example} -Predefined data structures include tuples, arrays, and lists. General -mechanisms for defining your own data structures are also provided. -They will be covered in more details later; for now, we concentrate on lists. -Lists are either given in extension as a bracketed list of -semicolon-separated elements, or built from the empty list "[]" -(pronounce ``nil'') by adding elements in front using the "::" -(``cons'') operator. +Predefined data structures include tuples, arrays, specialized byte +arrays and lists. General mechanisms for defining your own data +structures are also provided. They will be covered in more details +later; for now, we concentrate on lists. Lists are either given in +extension as a bracketed list of semicolon-separated elements, or built +from the empty list "[]" (pronounce ``nil'') by adding elements in front +using the "::" (``cons'') operator. \begin{caml_example} let l = ["is"; "a"; "tale"; "told"; "etc."];; "Life" :: l;; |