add2 or more numeric operands Returns the sum of the operands. (add 3 -5 8) # returns 6 sub (subtract)2 numeric operands Returns the result of second operand subtracted from the first. (sub 7 15) # returns -8 mul (multiply)2 or more numeric operands Returns the product of the operands. (mul -3 5 5) # returns -75 div (divide)2 numeric operands Returns the result of first operand divided by the second. (div 4 2) # returns 2 mod (modulus)2 numeric operands Returns the remainder of dividing the first operand by the second. (mod 13 4) # returns 1 (13 divided by 4 is 3 remainder 1)` and2 or more boolean operands Returns true if all of the operands are true. Otherwise, false. (and true true true true) # returns true
(and true false true true) # returns false
(and false false) # returns false or2 or more boolean operands Returns true if at least one of its operands is true. Otherwise, false. (and true true true true) # returns true
(and true false true true) # returns true
(and false false) # returns false not1 boolean operand Returns the logical inverse of its operand. (not true) # returns false
(not false) # returns true eq (equal)2 or more operands Returns true if the operands are all equal to each other. Otherwise, false. (eq 3 3 3) # returns true
(eq 3 7 3) # returns false lt (less than)2 or more numeric operands Returns true if each operand is less than the operand to its right. Otherwise, false. (lt 3 5) # return true
(lt 3 5 8) # return true
(lt 3 3 8) # return false (3 is not less than 3)
(lt 4 2) # return false lte (less than or equal)2 or more numeric operands Returns true if each operand is less than the operand to its right or equal to it. Otherwise, false. (lt 3 5) # return true
(lt 3 5 8) # return true
(lt 3 3 8) # return true (3 is equal to 3)
(lt 4 2) # return false gt (greater than)2 or more numeric operands Returns true if each operand is greater than the operand to its right. Otherwise, false. (lt 5 3) # return true
(lt 8 5 3) # return true
(lt 8 3 3) # return false (3 is not greater than 3)
(lt 2 4) # return false gte (greater than or equal)2 or more numeric operands Returns true if each operand is greater than the operand to its right or equal to it. Otherwise, false. (lt 5 3) # return true
(lt 8 5 3) # return true
(lt 8 3 3) # return true (3 is equal to 3)
(lt 2 4) # return false print1 or more string operands Displays the string operands in the output window. (If more than one operand, they are displayed in order.) (print "hello, world") # displays "hello, world" to the output windows input (read keyboard)1 optional string operand Prompts user with a message box with message (the string operand) and waits for them to enter text and hit OK. Returns the text returned by the user (an empty string if they didn't type anything). (readkb "Type something, please.") # prompts the user with a message window, and waits for them to type input and click OK concat (concatenate)2 or more string operands Returns string which is concatenation of the operands. (concatenate "fee" "fi" "fo" "fum") # returns "feefifofum" find2 string operands Locates the second string inside the first, returning the index of the first match (from the left). (The first character of a string is index 0, the second is index 1, the third index 2, and so on.) (find "hiho hiho" "ho") # returns 2, the index of the first occurrence of "ho" in "hiho hiho" Returns -1 if no match is found. slice1 string operand and 1 or 2 numeric operands Returns a substring of the string operand. The first numeric operand is the start index, and the second is the end index. The end index is non-inclusive, i.e., an end index of 5 means 'up to but not including the character at index 5'. (If no end index is given, the whole rest of the string is returned.) (slice "eat my shorts" 4) # returns "my shorts"
(slice "eat my shorts" 4 6) # returns "my"
(slice "eat my shorts" 0 6) # returns "eat my" count1 operand (a list, string, or dict) Returns the number of members in a list, key-value pairs in a dictionary, or characters in a string. (count "moo") # returns 3 id (identical)2 or more operands Returns true if the operands are identical (i.e. they are all in fact the very same object, not just equivalent to each other). Otherwise, returns false. list0 or more operands Create a list. (list) # an empty list
(list x y z) # a list with the members x, y, and z (in that order) dict (dictionary)0 or more operands Create a dictionary. (dict) # an empty dictionary
(dict "cat" x "dog" y) # a dictionary with key:"cat"/value:x and key:"dog"/value:y
|
The examples for or, lte, gt, and gte are all incorrect (they use the wrong operator), probably because they were cut-and-pasted from examples above.
-Damon