Return multiple values: Difference between revisions
Content added Content deleted
(→{{header|OCaml}}: Space safety of tuples) |
m (→Space safety of tuples: links) |
||
Line 254:
Used: 1</pre>
The workaround is to explicitly access to each value with functions like [http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html#VALfst <code>fst</code>] and [http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html#VALsnd <code>snd</code>] that return only one element of the tuple:
<lang ocaml>val fst : 'a * 'b -> 'a
val snd : 'a * 'b -> 'b</lang>
<lang ocaml>let pair a b =
|