next up previous contents index
Next: Testing an expression with Up: List of primitives Previous: Operations on lists   Contents   Index

Booleans

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

Primitives Arguments Use
true none Returns "true.
false none Returns "false.
word? a Returns true if a is a word, false otherwise.
number? a Returns true if a is a number, false otherwise.
integer? a returns true if a is a whole number, false otherwise.
list? a Returns true if a is a list, false otherwise.
empty? a Returns true if a is an empty word or an empty list, false otherwise.
equal? a b Returns true if a and b are equal, false otherwise.
before? a b : words Returns true if a is before b in terms of alphabetical order, false otherwise.
member? a b If b is a list, specifies if a is an element of b. If b is a word, specifies if a is a letter in b.
member a b If b is a list, look for the element a in this list. There are two possible outcomes:
-If a is in b, returns a sublist containing all list elements from the first instance of a in b.
-If a is not in b, returns the word false.
If b is a word, look for the character a in this word. There are two possibilities:
- If a is in b, return the latter part of the word, starting from a.
-Otherwise, return the word false.
member ``o ``cocoa return ocoa
member 3 [1 2 3 4] returns [3 4]
pd?, pendown? anything Returns the word true is the pen is down, false otherwise.
visible? anything Returns the word true if the turtle is visible, false otherwise.
prim?, primitive? a: word Returns true if the word is an XLOGO primitive, false otherwise.
proc?, procedure? a: word Returns true if the word is a procedure defined by the user, false otherwise.
var? variable? a: word Return true if :a is a variable, false otherwise.


next up previous contents index
Next: Testing an expression with Up: List of primitives Previous: Operations on lists   Contents   Index
Loïc 2008-06-08