|
IndexOfWords
A SL reference for programmers
Index of WordsThe following index of words are available in the SL script engine within jarvar. A link to a page dedicated to the use and any peculiarities of the word is supplied. Although based on some ideas from FORTH and LISP, do not assume a word has the same effect as in any of those languages. All reserved words are impossible to redefine. Note that redefine does not mean the same as have their value changed. Although this is also a possibility. The word standard can be used to make all words have their current standard values. Non reserved words are in standard and maybe some other books. These books in turn are in standard. If you forget some of the standard by error, then restore will recover all the essential standard. The Grammar Words[ and ] are reservedThe [ and ] characters are used to enclose a list. An example list is [ 3 5 7 11 ]. It is important to have a space both before and after [ and ]. A list is a single item, which can have many items within it. all is reservedReturns a list of all findable words. author is reservedSets the current book to the same as the context book, so that words can be added to the current book. book is reservedMakes a new book. Books can be used to separate words defined, into useful groups. box in standardTakes any item and returns a modified item which is literal. This is useful to prevent any item from being evaluated by using static. context is reservedThe book which is searched first to find the meaning of any word. create is reservedTakes an item and a string name, making the name return the literal item when it is evaluated. current is reservedThe book where new words are authored. does is reservedTakes an item and makes it the new meaning of the the word following does. drop in standardTakes an item and throws it away when you no longer need it. dup in standardTakes an item and returns two copies of the item. The word dup is short for duplicate. find in standardTakes a string, and tries to find a word with the name the same as the content of the string. forget is reservedTakes a string, and removes the word and meaning which is named by the string. If the name is a book, all the book will be forgotten, along with any books within it. index in standardTakes a list or string and a number, and returns the numbered element or character. join in standardTakes a list and an item, and places the item at the beginning of the list and returns it. length in standardTakes a list or string, and returns a number indicating the length. literal is reservedThis word is not used directly, but has no meaning except return the following item or list as an item on the stack. make is reservedTakes a string and makes a word with the name contained in the string, giving it the meaning of the item following the word make. over in standardTakes the item below the top item, and makes a copy and returns it as the new top item, leaving the old top item and the one duplicated below it. parse is reservedThis is used within word meanings to get the next following item which follows the word having parse within its meaning. prim is reservedThis word is for execution of special actions. print in standardThis word takes an item and returns a string representing the character form of the item. read in standardThis word takes a string, and returns an item representing the internal form of the meaning of the string. reserved is reservedTakes a string, finds the word, and makes it reserved. This is not reversible and should be used with discretion. restore is reservedRestores the standard by deletion of any overriding definitions of new meanings for words with the same name as standard words. reverse in standardTakes a list and reverses the order of all its items. rotary in standardTakes two strings and compares them using the characters of the string as rotary extension if the strings are different in length. same in standardTakes two strings and checks if they contain the same character sequence. split in standardTakes two strings, and uses the top string as a dividing element, so returning a list of strings which were separated by the dividing string. stack is reservedTakes a string and makes a stack named by its contents. It takes an item off on use, and adds an item on when the name follows to. standard is reservedstatic is reservedThis word has the meaning [ literal literal ]. step in standardTakes a list or string, and returns the list without the first item, or the string with the first character moved to the end of the string. swap in standardTakes two items, and returns them in the opposite order. top in standardTakes a list and returns the list without the first item, and then the first item on top of that. to is reservedThe name following the word to, has its meaning set to be a static copy of the item taken from the stack. trim in standardTakes a string or a list, and a number. Returns the list or string trimmed to include only the first number of elements or characters. Negative numbers count from the end of the list or string. unite in standardTakes two strings and returns a single string with the top string appended after the item under it. write is reservedTakes an item and a word, an sets the new content of the word. The Control Flow WordsThe point to understand here is that anything but false is logically true. and in standardTakes two items and returns the logical and of them. catch is reservedThe item following catch is setup to be executed if there is an error before the word containing catch has finished execution. cue is reservedTakes an item and sets it to be executed when the word containing cue has finished execution. else is reservedTakes an item, and if its true, then the item following else is executed, otherwise, the item following the item following else is executed. error is reservedTakes a string and throws an error, which maybe caught by catch or reported ending the program. false is reservedReturns the logical false to the stack. if is reservedTakes an item, and if its true, then the item following if is executed. not in standardTakes an item and returns the logical opposite of it. or in standardTakes two items and returns the logical or of them. true is reservedReturn a logical true to the stack. while is reservedTakes an item and if its true, it executes the word following while. After this execution happens, the while is repeated until a logical false is taken from the stack. The Mathematical WordsThere are two kinds of number in SL. The integer is a whole number, and a string can be used as an integer, and its last character is the number. Single length strings are printed as numbers. Fractions are fully extended into complex numbers. Complex numbers are the second type of number. All real numbers are stored internally as complex numbers. abs in standardTakes a number and returns the absolute magnitude of the number. conj in standardTakes a number and returns the complex conjugate. divide in standardTakes two numbers and returns the number below the top divided by the top. equal in standardTakes two numbers and returns a true if they are equal, or the false if they are not. exp in standardTakes a number and returns the complex exponential of it. imagine in standardTakes a number and multiplies it by the root of minus one. integer in standardTakes a number and returns the integer part. invert in standardTakes a number and divides one by it. log in standardTakes a number and returns the complex logarithm. minus in standardTakes two numbers and returns the number below the top minus the top. negate in standardTakes a number and returns the negative of it. order in standardTakes two numbers and returns true if the top is exponent numerically smaller than the number below. This is for ordering numbers. plus in standardTakes two numbers and returns the number below the top added to the top. power in standardTakes two numbers and returns the number below the top to the power of the top. times in standardTakes two numbers and returns the number below the top multiplied by to the top. The Application Wordsapp in standard | |