From 1b3ebf07caf2de960e59430ebbeba20d682c0d34 Mon Sep 17 00:00:00 2001 From: Josh Langsfeld Date: Mon, 22 Jun 2015 11:01:58 -0400 Subject: [PATCH] Extra explanation for MATLAB users on using array-like objects [ci skip] --- doc/manual/noteworthy-differences.rst | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/manual/noteworthy-differences.rst b/doc/manual/noteworthy-differences.rst index 0926b57c35ec6..16672a638d313 100644 --- a/doc/manual/noteworthy-differences.rst +++ b/doc/manual/noteworthy-differences.rst @@ -46,7 +46,14 @@ some noteworthy differences that may trip up Julia users accustomed to MATLAB: the syntax ``[a b; c d]`` is used to avoid confusion. In Julia v0.4, the concatenation syntax ``[x, [y, z]]`` is deprecated in favor of ``[x; [y, z]]``. - In Julia, ``a:b`` and ``a:b:c`` construct :obj:`Range` objects. To construct - a full vector like in MATLAB, use :func:`collect(a:b) `. + a full vector like in MATLAB, use :func:`collect(a:b) `. Generally, + there is no need to call ``collect`` though. ``Range`` will act like a normal + array in most cases but is more efficient because it lazily computes its + values. This pattern of creating specialized objects instead of full arrays + is used frequently, and is also seen in functions such as :func:`linspace + `, or with iterators such as :func:`enumerate `, and + :func:`zip `. The special objects can mostly be used as if they were + normal arrays. - Functions in Julia return values from their last expression or the ``return`` keyword instead of listing the names of variables to return in the function definition (see :ref:`man-return-keyword` for details).