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





member word1 arg2



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.