
Logo Commands
The Workspace
Working with Data
Put data together
Access data
Test data or data contents
Create and manipulate arrays
Read, write, and print data
Working with Properties
Multimedia commands
Put data together
Access data
Test data or data contents
Create and manipulate arrays
Read, write, and print data
Working with Properties
Multimedia commands
Counts the number of items in its input.
COUNT word COUNT list
COUNT reports the number of elements in its input. If its input is a word, COUNT reports the number of characters. If the input is a list, COUNT reports the number of elements in the list.
COUNT "ELEMENTARY Result: 10 COUNT [ELEMENTARY] Result: 1 COUNT [[MT. WASHINGTON] [MT. RAINIER] [MAUNA LOA]] Result: 3
Checks whether a procedure is defined.
DEFINED? name
DEFINED? reports TRUE if the input is a name of a primitive procedure or
a user-defined procedure; otherwise it reports FALSE. Compare with PROCEDURE?
,
which reports TRUE only if the input is a user-defined procedure, and PRIMITIVE?
,
which reports TRUE only if the input is a built-in command.
Checks whether a name is empty.
EMPTY? word EMPTY? list
EMPTY? reports TRUE if the input is the empty word (“||) or the empty list ([]); otherwise, it reports FALSE.
Checks for its input being a list.
LIST? object
LIST? reports TRUE if its input is a list; otherwise, it reports FALSE.
See also TYPEOF
, NUMBER?
and WORD?
.
Checks its input for being a macro.
MACRO? word
MACRO? reports TRUE if the input word is the name of a Logo macro;
otherwise, it reports FALSE. Compare with DEFINED?
,
which reports TRUE for both primitives and procedures, and PROCEDURE?
, which reports
FALSE for primitives and TRUE for user-defined procedures. All these commands report
similarly for both buried and unburied procedures. See also .MACRO
and .DEFMACRO
for more information about macros.
Checks if an object is part of another object.
MEMBER? word-or-list word-or-list (MEMBER? word-or-list word-or-list TRUE)
MEMBER? reports TRUE if the first input is an element of the second input; otherwise it reports FALSE.
If the second input is a list, MEMBER? compares each element of the list. It does not scan any sub-lists, unless it is caled with a third, optional input set to TRUE.
MEMBER? "A "ABC Result: TRUE MEMBER? [INSIDE] [A [B [INSIDE] C] D] Result: FALSE (MEMBER? [INSIDE] [A [B [INSIDE] C] D] TRUE) Result: TRUE
Checks whether its input is assigned a value.
NAME? name
NAME? reports TRUE if the input is a name of a variable; otherwise; it reports
FALSE. See also TYPEOF
, LIST?
, NUMBER?
, and WORD?
.
Checks its input for being a number.
NUMBER? object
NUMBER? reports TRUE if its input is a number; otherwise it reports FALSE.
Note that Logo treats quoted numbers or numbers that have been put together
as numbers as well.
See also LIST?
, NAME?
, and WORD?
.
NUMBER? WORD "4 "1 Result: TRUE NUMBER? 41 Result: TRUE NUMBER? [41] Result: FALSE NUMBER? FIRST [41] Result: TRUE NUMBER? 4.1 Result: TRUE
Checks its input for containing a property list.
PLIST? word
PLIST? outputs TRUE if a property list exists under the given name, FALSE otherwise.
Checks its input for being a built-in procedure or macro.
PRIMITIVE? word
PRIMITIVE? reports TRUE if the input word is the name of a built-in Logo command or macro;
otherwise, it reports FALSE. User-defined procedures or macros are not considered primitives;
hence PRIMITIVE? reports FALSE when given their names as input. Compare with DEFINED?
,
which reports TRUE for both primitives, macros and procedures, and PROCEDURE?
, which reports
FALSE for primitives and TRUE for user-defined procedures and macros. All these commands report
similarly for both buried and unburied procedures and macros. Remember that a macro is a special
form of a procedure, see .MACRO
for details.
Checks its input for being a user-defined procedure.
PROCEDURE? word
PROCEDURE? reports TRUE if the input word is the name of a user-defined Logo procedure;
otherwise, it reports FALSE. Compare with DEFINED?
,
which reports TRUE for both primitives and procedures, and PRIMITIVE?
, which reports
TRUE for primitives and FALSE for user-defined procedures. All these commands report
similarly for both buried and unburied procedures.
TO SAY.HELLO PRINT "HELLO END SAY.HELLO defined PRIMITIVE? "SAY.HELLO Result: FALSE PROCEDURE? "SAY.HELLO Result: TRUE DEFINED? "SAY.HELLO Result: TRUE
Checks its input for being a word.
WORD? object
WORD? reports TRUE if its input is a word; otherwise it reports FALSE.
See also LIST?
, NAME?
, and NUMBER?
.
WORD? 123 Result: TRUE WORD? "FD Result: TRUE WORD? [FD] Result: FALSE