Add, retrieve, call, or remove properties.
Properties are values that are stored as property lists. These lists are not traditional
THING can handle. Instead, there are separate commands
to create, to read, to set, to invoke, or to remove properties.
Many objects have built-in variables that belong to the object itself instead of the
toplevel workspace. A turtle, for example, has a variable
POSITION that sets or reports
the turtle's position. A turtle can be
MAKE a new position, like
ASK 0 [MAKE “POSITION [100 100]]. Alternatively, these object specific variables may
be accessed as properties of that object. Instead of
ASKing a turtle like above,
you can set the turtle's
POSITION property as in
PPROP 0 “POSITION [100 100].
Calls a property as a procedure.
CPROP name propertyname (CPROP name propertyname input-1 ...)
Many objects contain built-in procedures. Use the CPROP (Call PROPerty) command to call a
procedure of an object. Such a procedure definition is a special kind of property that
PPROP cannot access. The CPROP command accepts the name of the object, the name of the procedure,
and optionally, further inputs to that procedure. It may or may not output a value.
Getting or setting properties is usually not a problem if the property does not exist. An attempt to call a non-existing or non-callable property is an error, however.
Reports the property lists that contain a property with a given name.
GLIST takes as input the name of a property, a quoted word, and reports a list of all currently defined properties that have a value for that name.
PPROP "HERMAN "AGE 24 PPROP "GRISELDA "AGE 36 PPROP "GRISELDA "MOTHER "WINIFRED GLIST "AGE Result: [HERMAN GRISELDA] GLIST "MOTHER Result: [GRISELDA]
Retrieves a property.
GPROP name propertyname
GPROP reports the property value of a name that has been assigned a property with
PPROP. If the property list does not exist, GPROP reports the empty list.
GPROP also reports the built-in property values for objects like bit maps, or turtles.
PPROP, <product logopro>
PPROPS "CAR [TIRES 4 DOORS 2] GPROP "CAR "TIRES Result: 4 GPROP "CAR "DOORS Result: 2 GPROP "CAR "MPG Result: 
Reports the property list of a name.
PLIST reports the property list associated with its input. The property list is a list
of a property name or names paired with its property value or values. PLIST stands for
“Property LIST.” PLIST is handy for retrieving the state of a turtle, bitmap, or other objects.
Note that the PLIST command only returns those properties that actually have a value; properties
that are write-only, or callable properties are not returned.
PPROP "SHOES "SIZE 6 PPROP "HAT "COLOR "BROWN PLIST "SHOES Result: [SIZE 6] PLIST "HAT Result: [COLOR BROWN]
Stores a property.
PPROP name propertyname object
PPROP assigns a property pair to a Logo name. PPROP takes three inputs: the name with
which a property list should be associated, the property name, and the property value.
The first input to PPROP must be a word, a turtle number, or the name of an object;
the second input must be a word, and the third input can be either a word or a list.
PPROP stands for “Put PROPerty.” A property pair consists of a property name and its value.
PPROP can also be used to alter the properties of turtles, bitmaps, and other objects.
GPROP, <product logopro>
PPROP "MUSIC "COMPOSER "STRAVINSKY PPROP "MUSIC "COMPOSITION "PETROUCHKA PLIST "MUSIC Result: [COMPOSER STRAVINSKY COMPOSITION PETROUCHKA]
Stores a list of properties.
PPROPS name list
PPROPS is a handy method to store multiple properties into a property list. The second
input to PPROPS is a list of property pairs. The first word in the pair is the property,
the second item in the pair is the property value for that property. The list must be
of even length. PPROPS is handy for assigning multiple properties to turtles, bitmaps,
and other objects. See also
PPROPS "JOE [GENDER MALE AGE 24 ADDRESS [23 OAK STREET]] GPROP "JOE "AGE Result: 24 GPROP "JOE "GENDER Result: MALE GPROP "JOE "ADDRESS Result: [23 OAK STREET]
Removes a property.
REMPROP name propertyname
REMPROP removes a property and its value from the name with which it is associated.
REMPROP stands for “REMove PROPerty.” Built-in properties of objects cannot be removed.
The name may also be the number of a turtle, or the name of another object.
ERASE erases everything in memory, including all property lists. See also
PPROP "DOG "LEGS 4 PLIST "DOG Result: [LEGS 4] REMPROP "DOG "LEGS PLIST "DOG Result: