annotate scripts/general/colon.m @ 8213:d5e08881bba8

Add overloading of the colon operator
author David Bateman <dbateman@free.fr>
date Sun, 12 Oct 2008 15:28:00 +0100
parents
children 06094fa570a3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8213
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
1 ## Copyright (C) 2008 David Bateman
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
2 ##
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
3 ## This file is part of Octave.
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
4 ##
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
8 ## your option) any later version.
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
9 ##
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
13 ## General Public License for more details.
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
14 ##
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
18
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
19 ## -*- texinfo -*-
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
20 ## @deftypefn {Function File} {@var{r} =} colon (@var{a}, @var{b})
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
21 ## @deftypefnx {Function File} {@var{r} =} colon (@var{a}, @var{b}, @var{c})
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
22 ## Method of a class to construct a range with the @code{:} operator. For
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
23 ## example.
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
24 ##
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
25 ## @example
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
26 ## @group
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
27 ## a = myclass (@dots{})
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
28 ## b = myclass (@dots{})
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
29 ## c = a : b
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
30 ## @end example
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
31 ##
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
32 ## @seealso{class, subsref, subsasgn}
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
33 ## @end deftypefn
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
34
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
35 function r = colon (varargin)
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
36 error ("colon: not defined for class \"%s\"", class(varargin{1}));
d5e08881bba8 Add overloading of the colon operator
David Bateman <dbateman@free.fr>
parents:
diff changeset
37 endfunction