My favorites | Sign in
Project Home Downloads Wiki Issues
READ-ONLY: This project has been archived. For more information see this post.
Search
for
IndexOfWords  
A SL reference for programmers
Updated May 9, 2012 by jackokring

Index of Words

The 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 reserved

The [ 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 reserved

Returns a list of all findable words.

author is reserved

Sets the current book to the same as the context book, so that words can be added to the current book.

book is reserved

Makes a new book. Books can be used to separate words defined, into useful groups.

box in standard

Takes 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 reserved

The book which is searched first to find the meaning of any word.

create is reserved

Takes an item and a string name, making the name return the literal item when it is evaluated.

current is reserved

The book where new words are authored.

does is reserved

Takes an item and makes it the new meaning of the the word following does.

drop in standard

Takes an item and throws it away when you no longer need it.

dup in standard

Takes an item and returns two copies of the item. The word dup is short for duplicate.

find in standard

Takes a string, and tries to find a word with the name the same as the content of the string.

forget is reserved

Takes 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 standard

Takes a list or string and a number, and returns the numbered element or character.

join in standard

Takes a list and an item, and places the item at the beginning of the list and returns it.

length in standard

Takes a list or string, and returns a number indicating the length.

literal is reserved

This word is not used directly, but has no meaning except return the following item or list as an item on the stack.

make is reserved

Takes 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 standard

Takes 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 reserved

This is used within word meanings to get the next following item which follows the word having parse within its meaning.

prim is reserved

This word is for execution of special actions.

print in standard

This word takes an item and returns a string representing the character form of the item.

read in standard

This word takes a string, and returns an item representing the internal form of the meaning of the string.

reserved is reserved

Takes a string, finds the word, and makes it reserved. This is not reversible and should be used with discretion.

restore is reserved

Restores the standard by deletion of any overriding definitions of new meanings for words with the same name as standard words.

reverse in standard

Takes a list and reverses the order of all its items.

rotary in standard

Takes two strings and compares them using the characters of the string as rotary extension if the strings are different in length.

same in standard

Takes two strings and checks if they contain the same character sequence.

split in standard

Takes 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 reserved

Takes 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 reserved

The standard is a book.

static is reserved

This word has the meaning [ literal literal ].

step in standard

Takes 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 standard

Takes two items, and returns them in the opposite order.

top in standard

Takes a list and returns the list without the first item, and then the first item on top of that.

to is reserved

The name following the word to, has its meaning set to be a static copy of the item taken from the stack.

trim in standard

Takes 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 standard

Takes two strings and returns a single string with the top string appended after the item under it.

write is reserved

Takes an item and a word, an sets the new content of the word.

The Control Flow Words

The point to understand here is that anything but false is logically true.

and in standard

Takes two items and returns the logical and of them.

catch is reserved

The item following catch is setup to be executed if there is an error before the word containing catch has finished execution.

cue is reserved

Takes an item and sets it to be executed when the word containing cue has finished execution.

else is reserved

Takes 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 reserved

Takes a string and throws an error, which maybe caught by catch or reported ending the program.

false is reserved

Returns the logical false to the stack.

if is reserved

Takes an item, and if its true, then the item following if is executed.

not in standard

Takes an item and returns the logical opposite of it.

or in standard

Takes two items and returns the logical or of them.

true is reserved

Return a logical true to the stack.

while is reserved

Takes 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 Words

There 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 standard

Takes a number and returns the absolute magnitude of the number.

conj in standard

Takes a number and returns the complex conjugate.

divide in standard

Takes two numbers and returns the number below the top divided by the top.

equal in standard

Takes two numbers and returns a true if they are equal, or the false if they are not.

exp in standard

Takes a number and returns the complex exponential of it.

imagine in standard

Takes a number and multiplies it by the root of minus one.

integer in standard

Takes a number and returns the integer part.

invert in standard

Takes a number and divides one by it.

log in standard

Takes a number and returns the complex logarithm.

minus in standard

Takes two numbers and returns the number below the top minus the top.

negate in standard

Takes a number and returns the negative of it.

order in standard

Takes two numbers and returns true if the top is exponent numerically smaller than the number below. This is for ordering numbers.

plus in standard

Takes two numbers and returns the number below the top added to the top.

power in standard

Takes two numbers and returns the number below the top to the power of the top.

times in standard

Takes two numbers and returns the number below the top multiplied by to the top.

The Application Words

app in standard

The app is a book.

Powered by Google Project Hosting