Skip to content

Commit

Permalink
Extra explanation for MATLAB users on using array-like objects
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
jdlangs committed Jul 10, 2015
1 parent e3dfa56 commit 1b3ebf0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion doc/manual/noteworthy-differences.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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) <collect>`.
a full vector like in MATLAB, use :func:`collect(a:b) <collect>`. 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
<linspace>`, or with iterators such as :func:`enumerate <enumerate>`, and
:func:`zip <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).
Expand Down

0 comments on commit 1b3ebf0

Please sign in to comment.