Segment BindingΒΆ

The SegmentBinding type is used to indicate a range for a named symbol.

First give the symbol, then an = and finally a segment of values.

x = a..b
  x= a..b
                          Type: SegmentBinding Symbol

This is used to provide a convenient syntax for arguments to certain operations.

sum(i**2, i = 0..n)
    3     2
  2n  + 3n  + n
  -------------
        6
                          Type: Fraction Polynomial Integer

draw(x**2, x = -2..2)
  TwoDimensionalViewport: "x*x"
                          Type: TwoDimensionalViewport

The left-hand side must be of type Symbol but the right-hand side can be a segment over any type.

sb := y = 1/2..3/2
      1    3
  y= (-)..(-)
      2    2
                          Type: SegmentBinding Fraction Integer

The left- and right-hand sides can be obtained using the variable and segment operations.

variable(sb)
  y
                          Type: Symbol

segment(sb)
   1    3
  (-)..(-)
   2    2
                          Type: Segment Fraction Integer

See Also:

  • )help Segment
  • )help UniversalSegment
  • )show SegmentBinding

Table Of Contents

This Page