### A.5 Booleans

A boolean is a primitive which returns the word “true or the word “false. These primitives terminate in a question-mark.

 true

Returns "true.

 false

Returns "false.

 word? arg1

Returns true if arg1 is a word, false otherwise.

 number? arg1

Returns true if arg1 is a number, false otherwise.

 integer? arg1

returns true if arg1 is a whole number, false otherwise.

 list? arg1

Returns true if arg1 is a list, false otherwise.

 empty? arg1

Returns true if arg1 is an empty word or an empty list, false otherwise.

 equal? arg1 arg2

Returns true if arg1 and arg2 are equal, false otherwise.

 before? word1 word2

Returns true if word1 is before word2 in terms of alphabetical order, false otherwise.

 member? word1 arg2

• If arg2 is a list, specifies if word1 is an element of arg2.
• If arg2 is a word, specifies if word1 is a letter in arg2.

 member word1 arg2

• If arg2 is a list, look for the element word1 in this list. There are two possible outcomes:
• If word1 is in arg2, returns a sublist containing all list elements from the first instance of word1 in arg2.
• If word1 is not in arg2, returns the word false.
• If arg2 is a word, look for the character word1 in this word. There are two possibilities:
• If word1 is in arg2, returns the latter part of the word, starting from word1.
• Otherwise, return the word false.

member  “o “cocoa return ocoa
member  3 [1 2 3 4] returns [3 4]

 pendown?, pd

Returns the word true is the pen is down, false otherwise.

 visible?

Returns the word true if the turtle is visible, false otherwise.

 primitive?, prim? word1

Returns true if the word is an XLOGOprimitive, false otherwise.

 procedure?, proc? word1

Returns true if the word is a procedure defined by the user, false otherwise.

 var? variable? word1

Return true if :a is a variable, false otherwise.