a .. b



In contrib/share, I committed a new file "integer_sequence.lisp.". It
defines ".." to be
a infix operator that constructs a list of consecutive integers; examples:

  (%i5) load("integer_sequence.lisp")$

  (%i6) -1 .. 1;
  (%o6) [-1,0,1]

  (%i7) -1 .. a;
  (%o7) -1 .. a

Since ".." simplifies, you don't need to manually simplify after a
substitution:

  (%i8) subst(a=4,%);
  (%o8) [-1,0,1,2,3,4]

Use floor and ceiling on non-integer endpoints

  (%i11) sqrt(2) .. sqrt(15);
  (%o11) [2,3]

Return an empty list for a .. b when a > b

  (%i13) 0 .. -7;
  (%o13) []

Return a noun form for infinite lists, and some other cases

  (%i14) 0 .. inf;
  (%o14) 0 .. inf

  (%i16) %i .. %i + 5;
  (%o16) %i .. %i+5

Example usage:

  (%i15) part(taylor(exp(x),x,0,5), 1 .. 2);
  (%o15) x+1

Be careful with the binding powers---I suggest using parens.

  (%i17) 0 .. a + 1;
  (%o17) 0 .. a+1

  (%i18) subst(a = 3,%);
  (%o18) [0,1,2,3,4]

  (%i19) (0 .. a) + 1;
  (%o19) (0 .. a)+1

  (%i20) subst(a = 3,%);
  (%o20) [1,2,3,4]

Barton