Functional Problem Solving (CSC 151 2013F) : Reference

Positions


Building Positions

(position-new col row)
MediaScheme Position Procedure. Build a new position that represents the point at (col,row).

Accessing Components

(position-col pos)
MediaScheme Position Procedure. Extract the column from position pos.
(position-row pos)
MediaScheme Position Procedure. Extract the row from position pos.

Miscellaneous

(position? value)
MediaScheme Position Procedure. Determine if value is a position (or can be interpreted as such).
(position-offset position hoff voff)
MediaScheme Position Procedure. Create a new position, offset from position horizontally by hoff and vertically by voff.
(position-distance pos1 pos2)
MediaScheme Position Procedure. Compute the distance between pos1 and pos2.
(position-interpolate pos1 pos2 percent)
MediaScheme Position Procedure. Create a new position which is percent (expressed as a real number between 0 and 1) of the way from pos1 to pos2
(random-positions n cols rows)
MediaScheme Position Procedure. Create n positions, each of which is difficult to predict and each with a non-negative column less than cols and a non-negative row less than rows.

Samuel A. Rebelsky, rebelsky@grinnell.edu

Copyright (c) 2007-2013 Janet Davis, Samuel A. Rebelsky, and Jerod Weinman. (Selected materials are copyright by John David Stone or Henry Walker and are used with permission.)

Creative Commons License

This work is licensed under a Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/3.0/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.