Methods are special functions that are attached to pieces of data. We use them to manipulate Tables.

  • In this course, the methods we’ll be using are

    • row-n - consumes an index (starting with zero!) and produces a row from a table

    • order-by - consumes the name of a column and a Boolean value to determine if that table should be sorted by that column in ascending order

    • filter - consumes a Boolean-producing function, and produces a table containing only rows for which the function returns true

    • build-column - consumes the name of a new column, and a function that produces the values in that column for each Row

  • Unlike functions, methods can’t be used alone. They have a “secret” argument, which is the data they are attached to. They are written as part of that data, separated by a dot. For example:

    shapes.row-n(2)

  • Contracts for methods are different from other functions. They include the type of the data as part of their names. For example:

    <table>.row-n :: (index :: Number) -> Row

These materials were developed partly through support of the National Science Foundation, (awards 1042210, 1535276, 1648684, and 1738598). CCbadge Bootstrap by the Bootstrap Community is licensed under a Creative Commons 4.0 Unported License. This license does not grant permission to run training or professional development. Offering training or professional development with materials substantially derived from Bootstrap must be approved in writing by a Bootstrap Director. Permissions beyond the scope of this license, such as to run training, may be available by contacting contact@BootstrapWorld.org.