Fun with lists



-----Raymond Toy  wrote: -----

>One thing that would be nice is to have a simple syntax for Matlab's
>a:b:s which generates an vector starting at a and ending at b with a
>step of s.

Does this do what you had in mind?

(%i9) load(integer_sequence)$
(%i10) -1 .. 1;
(%o10) [-1,0,1]

(%i11) -1 .. -10;
(%o11) []

(%i12) a .. b;
(%o12) a .. b

(%i13) sublis([a=1,b=1],%);
(%o13) [1]

(%i14) 0 .. 2 .. 8;
(%o14) [0,2,4,6,8]

(%i15) 8 .. -2 .. 0;
(%o15) [8,6,4,2,0]

Barton