|
Table 5.1: Function Quick Reference |
|
|
Name | Arguments | Description |
|
|
Name | Arguments | Description |
|
|
|
|
| Math Functions |
| (l.5cmr.5cm)1-3
Log10 | <num> | Log base 10 of <num> |
| Log2 | <num> | Log base 2 of <num> |
| Ln | <num> | Natural log of <num> |
| LogN | <num> <base> | Log base <base> of <num> |
| Exp | <pow> | e to the power of <pow> |
| Pow | <num> <pow> | <num> to the power of <pow> |
| Sqrt | <num> | Square root of <num> |
| NthRoot | <num> <root> | <num> to the power of 1/<root> |
| Tan | <deg> | Tangent of <deg> degrees |
| Sin | <deg> | Sine of <deg> degrees |
| Cos | <deg> | Cosine of <deg> degrees |
| ATan | <num> | Inverse Tan of <num>, in degrees |
| ASin | <num> | Inverse Sine of <num>, in degrees |
| ACos | <num> | Inverse Cosine of <num>, in degrees |
| DegToRad | <deg> | Converts degrees to radians |
| RadToDeg | <rad> | Converts radians to degrees |
| Round | <num> <sig> | Rounds <num> to <sig> significant digits |
| Floor | <num> | Rounds <num> down to the next integer |
| Ceiling | <num> | Rounds <num> up to the next integer |
| AbsFloor | <num> | Rounds <num> toward 0 to an integer |
| Mod | <num> <mod> | Returns <num> mod <mod> or remainder of <num>/<mod> |
| Div | <num> <mod> | Returns round(<num>/<mod>) |
| ToInteger | <num> | Rounds a number to an integer, and changes internal representation |
| ToFloat | <num> | Converts number to internal floating-point representation |
| ToNumber | <> | |
| ToString | <num> | Converts a numerical value to a string representation |
| Sign | <num> | Returns +1 or -1, depending on sign of argument |
| Abs | <num> | Returns the absolute value of the number |
| Order | <list> | Returns a list of integers representing the order of <list> |
| Rank | <list> | Returns integers representing the ranked indices of the numbers of<list> |
| Median | <list> | Returns the median value of the numbers in <list> |
| Min | <list> | Returns the smallest of <list> |
| Max | <list> | Returns the largest of <list> |
| StDev | <list> | Returns the standard dev of <list> |
| Sum | <list> | Returns the sum of the numbers in <list> |
| Median | <list> | Returns the median of a set of values |
| Quantile | <list> <num> | Returns the <num> quantile of the numbers in <list> |
| SeedRNG | <num> | Seeds the random number generator with <num> to reproduce a random sequence |
| RandomizeTimer | - | Seeds the RNG with the current time |
| Random | - | Returns a random number between 0 and 1 |
| RandomDiscrete | <num> | Returns a random integer between 1 and <num> |
| RandomUniform | <num> | Returns a random floating-point number between 0 and <num> |
| RandomNormal | <mean> <stdev> | Returns a random number according to the standard normal distribution with <mean> and <stdev> |
| RandomExponential | <mean> | Returns a random number according to exponential distribution with mean <mean> (or decay 1/mean) |
| RandomLogistic | <p> | Returns a random number according to the logistic distribution with parameter <p> |
| RandomLogNormal | <median> <spread> | Returns a random number according to the log-normal distribution with parameters <median> and <spread> |
| RandomBinomial | <p> <n> | Returns a random number according to the Binomial distribution with probability <p> and repetitions <n> |
| RandomBernoulli | <p> | Returns 0 with probability (1-<p>) and 1 with probability <p> |
|
|
(l.5cmr.5cm)1-3
Print | <value> | Prints <value> to stdout, appending a new line afterwards. stdout is the console (in Linux) or the file stdout.txt (in Windows) |
| Print_ | <value> | Prints <value> to stdout, without appending a newline afterwards |
| Format | <value> | UNIMPLEMENTED |
| FileOpenRead | <filename> | Opens a filename, returning a stream to be used for reading information |
| FileOpenWrite | <filename> | Opens a filename, returning a stream that can be used for writing information. Overwrites if file already exists |
| FileOpenAppend | <filename> | Opens a filename, returning a stream that can be used for writing info. Appends if the file already exists, opens if file does not |
| FileClose | <filestream> | Closes a filestream variable. Pass the variable name, not the filename |
| FilePrint | <filestream> <value> | Like Print, but to a file. |
| FilePrint_ | <filestream> <value> | Like Print_, but to a file. |
| FileReadCharacter | <filestream> | Reads and returns a single character from a filestream |
| FileReadWord | <filestream> | Reads and returns a `word' from a file; the next connected stream of characters not including a ' ' or a newline. Will not read newline characters |
| FileReadLine | <filestream> | Reads and returns a line from a file; all characters up until the next newline or the end of the file |
| FileReadList | <filename> | Given a filename, will open it, read in all the items into a list (one item per line), and close the file afterwards |
| FileReadTable | <filename> <opt-sep> | Like FileReadList, but reads in tables. Optionally, specify a token separator |
| FileReadText | <filename> | Reads all of the text in the file into a variable |
| EndOfLine | <filestream> | Returns true if at end of line |
| EndOfFile | <filestream> | Returns true if at the end of a file |
|
|
(l.5cmr.5cm)1-3
MakeWindow | <colorname> | Creates main window, in color named by argument, or grey if no argument is named |
| MakeImage | <filename> | Creates an image by reading in an image file (jpg, gif, png, bmp, etc.) |
| MakeLabel | <text> <font> | Creates a single line of text filled with <text> written in font <font> |
| MakeTextBox | <text> <font> | Creates a sized box filled |
| <width> <height> | with <text> written in font <font> |
| MakeColor | <colorname> | Creates a color based on a color name |
| MakeColorRGB | <red> <green> <blue> | Creates a color based on red, green, and blue values |
| MakeFont | <ttf_filename> <style> <size> <fgcolor> <bgcolor> <anti-aliased> | Creates a font which can be used to make labels |
| SetCursorPosition | <textbox> <position> | Move the editing cursor in a textbox |
| GetCursorPosition | <textbox> | Gets the position of the editing cursor |
| SetEditable | <textbox> <status> | Turns on or off the editing cursor |
| GetText | <textobject> | Returns the text in a textbox or label |
| GetInput | <textbox> <escape-key> | Allows a textbox to be edited by user, returning its text when <escape-key> is pressed. |
| SetText | <textobject>, <text> | Sets the text in a textbox or label |
| SetFont | <textobject>, <font> | Changes the font of a text object |
| Move | <object> <x> <y> | Move an object (e.g., an image or a label to an x,y location) |
| MoveCorner | <object> <x> <y> | Moves an image or label by its upper corner. |
| GetSize | <object> | Returns a list of dimensions <x,y> of a graphical object. |
| AddObject | <object> <parent> | Adds an object to a parent object (window) |
| RemoveObject | <object> <parent> | Removes an object from a parent window |
| Show | <object> | Shows an object |
| Hide | <object> | Hides an object |
| Draw | <object> | Redraws a widget and its children |
| DrawFor | <object> <cycles> | Draws for exactly <cycles> cycles, then returns |
| Circle | <x> <y> <r> | Creates circle with
radius r centered at position x,y |
| Ellipse | <x> <y> <rx> <ry> | Creates
ellipse with radii rx and ry centered at position x,y |
| Square | <x> <y> <size> | Creates Square with
width size centered at position x,y |
| Rectangle | <x> <y> <dx> <dy> | Creates
rectangle with size (dx, dy) centered at position x,y |
| Line | <x> <y> <dx> <dy> | Creates
line starting at x,y and ending at x+dx, y+dy |
|
|
(l.5cmr.5cm)1-3
LoadSound | <filename> | Loads a soundfile from the filename, returning a variable that can be played |
| PlayForeground | <sound> | Plays the sound `in the foreground', not returning until the sound is complete |
| PlayBackground | <sound> | Plays the sound 'in the background', returning immediately |
| Stop | <sound> | Stops a sound playing in the background from playing |
| MakeSineWave | | NOT IMPLEMENTED |
| MakeSquareWave | | NOT IMPLEMENTED |
| MakeSawtoothWave | | NOT IMPLEMENTED |
| MakeChirp | | NOT IMPLEMENTED |
|
|
(l.5cmr.5cm)1-3
GetTime | <> | Gets a number, in milliseconds, representing the time since the PEBL program began running. |
| Wait | <time> | Pauses execution for <time> ms |
| IsKeyDown | <keyval> | Determines whether the key associated with <keyval> is down |
| IsKeyUp | <keyval> | Determines whether the key associated with <keyval> is up |
| IsAnyKeyDown | <> | Determines whether any key is down. |
| WaitForKeyDown | <keyval> | Waits until <keyval> is detected to be in the down state |
| WaitForAnyKeyDown | <> | Waits until any key is detected in down state |
| WaitForKeyUp | <keyval> | Waits until <keyval> is in up state. |
| WaitForAllKeysUp | | Waits until all keys are in up state |
| WaitForAnyKeyDownWithTimeout | | |
| <time> | Waits for a key to be pressed, but only for <time> ms |
| WaitForKeyListDown | | |
| <list-of-keyvals> | Waits until one of the keys is in down state |
| WaitForKeyPress | <key> | Waits until <key> is pressed |
| WaitForAnyKeyPress | <> | Waits until any key is pressed |
| WaitForKeyRelease | <key> | Waits until <key> is released |
| WaitForListKeyPress | <list-of-keys> | Waits until one of <list-of-keys> is pressed |
| RegisterEvent | <> | NOT IMPLEMENTED |
| StartEventLoop | <> | NOT IMPLEMENTED |
| ClearEventLoop | <> | NOT IMPLEMENTED |
| SignalFatalError | <message> | Halts execution, printing out message |
| TranslateKeyCode | <> | Converts a keycode to a key name |
| TimeStamp | | Returns a string containing the current date and time |
| GetPEBLVersion | <> | Returns a string indicating which version of PEBL you are using |
| GetNIMHDemographics | <code>, <window>, <file> | Asks NIMH-related questions |
| IsNumber | <variant> | Tests whether <variant> is a number |
| IsInteger | <variant> | Tests whether <variant> is an integer-type number |
| IsFloat | <variant> | Tests whether <variant> is a floating-point number |
| IsString | <variant> | Tests whether <variant> is a string |
| IsList | <variant> | Tests whether <variant> is a List |
| IsTextBox | <variant> | Tests whether <variant> is a TextBox |
| IsImage | <variant> | Tests whether <variant> is an Image |
| IsLabel | <variant> | Tests whether <variant> is a Text Label |
| IsAudioOut | <variant> | Tests whether <variant> is a AudioOut stream |
| IsFont | <variant> | Tests whether <variant> is a Font |
| IsColor | <variant> | Tests whether <variant> is a Color |
| IsFileStream | <variant> | Tests whether <variant> is a FileStream |
| IsWidget | <variant> | Tests whether <variant> is any Widget |
|
|
(l.5cmr.5cm)1-3
Shuffle | <list> | Returns a new list with the items in list shuffled randomly. |
| Repeat | <item> <n> | Repeats an item n times in a list |
| RepeatList | <list> <n> | Makes a new list containing
the elements of <list> repeated <n> times |
| Sequence | <start> <end> <step> | Makes a sequence of numbers
from <start> to <end>, with <step>-sized increments |
| ChooseN | <list> <n> | Returns a sublist of <n> items from a
list, in the order they appear in the original list |
| SampleN | <list> <n> | Returns a randomly-ordered sublist of <n> items from a list |
| SampleNWithReplacement | <list> <n> | Returns a sublist of <n> items from a list |
| DesignLatinSquare | <list1> <list2> | |
| DesignGrecoLatinSquare | <list1> | <list2> <list3> |
| DesignBalancedSampling | <list> | <number> |
| DesignFullCounterbalance | <list1> | <list2> |
| CrossFactorWithoutDuplicates | <list> | Returns a list of all pairs of items in the list, excluding pairs that where an element appears twice. |
| | |
| Rotate | <list> <n> | Rotates a list by <n> items. |
| FoldList | <list> <n> | Folds list into length-n sublists. |
| Flatten | <list> | Flattens a nested list completely |
| FlattenN | <list> <n> | Flattens n levels of a nested list |
| Length | <list> | Returns the number of elements in a list. |
| First | <list> | Returns the first item in a list. |
| Last | <list> | Returns the last item in a list. |
| Merge | <list1> <list2> | Combines two lists. |
| Append | <list> <item> | Adds <item> to <list> |
| List | <item1>, <item2>... | Makes a list out of items |
| Sort | <list> | Sorts a list by its values. |
| SortBy | <list> <key> | Sorts list by the values in <key> |
| Nth | <list> <n> | Returns the nth item in a list. |
| Subset | <list> <list-of-indices> | |
| ExtractListItems | <list> <list-of-indices> | |
| IsMember | <item> <list> | Checks whether <item> is a member of <list> |
| Replace | <template> <replacementList> | Replaces items in a data structure |
| RemoveDuplicates | | NOT IMPLEMENTED |
| MakeMap | | NOT IMPLEMENTED |
| Transpose | <list-of-lists> | Transposes a list of equal-length lists. |
| SubList | <list> <start> <finish> | Returns a sublist of a list. |
| Remove | <list> <n> | Removes an item from a list. Unimplemented |
|
|
(l.5cmr.5cm)1-3
Uppercase | <string> | Returns uppercased string |
| Lowercase | <string> | Returns lowercased string |
| SplitString | <string> <split> | Splits <string> into a list of
<split>-delimited substrings |
| StringLength | <string> | Returns the length of a string |
| SubString | <string> <position> <length> | Returns a substring |
| FindInString | <string> <key> | Returns position of <key> in <string> |
|