-
Notifications
You must be signed in to change notification settings - Fork 5
Eden Functions
A library of useful functions is provided for Eden, many of which have been ported over from the older tkeden tool. However, not all functions in tkeden are available here (yet) and there are many which are specific to this javascript implementation. This page documents all core functions, some plugins such as Canvas provide many more functions and these are documented on the relevant plugin wiki page.
- eager() - Flip autocalc to process changes
- time() - Get current time in seconds since epoc
- writeln(msg) - Print console output
- apply(...)
- forget(symbol) - Delete observable, func or proc
- forgetAll(...) - Delete groups of observables
- error(msg) - Display an error message
- nameof(symbol) - Get name from symbol pointer or object
- todo(code) - Execute code but do it later
- touch(...) - Expire symbol pointer(s)
- doDefault(value, default) - If value is undefined, return default
- include2(url) - Include a file using new parser DEPRECATED
- execute2(code) - Execute a string as js-eden script using new parser
- agentFromFile(name, file, execute)
- Object() - Make an empty dictionary object
- Point(x,y) - Make a Point object
- createView(name, type) - Construct a new dialog view
- showView(name) - Make a hidden view visible
- hideView(name)
- highlightView(name)
- stopHighlightView(name)
- destroyView(name)
- moveView(name, x, y) - Change position of view dialog
- resizeView(name, width, height) - Change size of view dialog
- showObservables(...) - Display an observable list view with specific configuration
- roundDown(number, [precision])
- roundUp(number, [precision])
- roundMultiple(number, multiple)
- abs(number) - Absolute value
- acos(angle) - Arc Cosine
- asin(angle) - Arc Sine
- atan(angle) - Arc Tan
- ceil(number) - Ceiling
- cos(angle) - Cosine
- exp(number) - Exponent
- floor(number) - Floor
- ln(number) - Log
- log(number, [base]) - Logarithm
- max(value, [...]) - Get maximum value from arguments or list
- min(value, [...]) - Get minimum value from arguments or list
- mod(x, n) - Modulus
- pow(power, value) - Power
- randomBoolean([probability])
- randomInteger(lower, upper)
- randomFloat(lower, upper)
- xorshiftRandomGenerator()
- random() - Random number
- round(number, [precision]) - Round
- sin(angle) - Sine
- sqrt(number) - Square Root
- sum(...) - Sum all arguments or a list
- tan(angle) - Tangent
- array(size, [initial]) - Make a list of given size
- positionInList(value, list, [lowerbound, issorted])
- reverse(list)
- search(value, list, compare, [lowerbound, issorted])
- sort(list, [function])
- sublist(list, from, to)
- tail(list)
- char(value)
- int(value)
- charCode(value)
- str(value)
- type(value)
- isBoolean(value)
- isCallable(value)
- isChar(value)
- isDefined(observable)
- isValue(value)
- isFunc(value)
- isInt(value)
- isList(value)
- isNaN(value)
- isNumber(value)
- isObject(value)
- isPoint(value)
- isPointer(value)
- isProc(value)
- isString(value)
- edenCode(string)
- concat(...)
- lowercase(string)
- RE(...)
- positionOfRE(...)
- escapeRE(string)
- replaceFirst(source, search, replacement)
- substitute(...)
- substr(string, from, [to])
- substringPosition(substr, target, [from])
- trim(string)
- uppercase(string)
- alias(newname, original) - Allow an observable to be an alias for another
- definitionOf(observable) - Get the definition as a string
- definitionRHS(observable) - Get definition expression
- isDependent(obs1,obs2)
- isDependency(observable)
- patch(name, func)
- withAppendedItem(target, item)
- compose(func1,func2)
- foldl(func, initial, list)
- foldr(func, initial, list)
- List(...)
- map(func, ...)
- mapPartial(func, ...)
- curry(func, ...)
- partApply(func, ...)
- sequenceItoJ(low, high, ...)
- sequenceN(low, ...)
- sequenceArithmetic(low, high, [...])
- sequenceArithmeticN(low, ...)
- sequenceList(func, [...])
- sequencePrevious(func, init, ...)
- number - Any floating point or integer value
Returns the absolute value of the number, removing any negative sign.
- number - Any floating point value
Returns the number rounded up to the nearest integer.
- number - Any floating point angle in degrees
Returns the cosine of the number.
- name - A string name to give the view
- type - Type of view to create.
Constructs a dialog view of the specified type. The types of views available can be found in the menu bar and depends upon what plugins have been loaded.
- number - Any floating point or integer value
Returns e to the power of number.
- script - A string of Eden script.
Parses and executes the string as an Eden script.
- number - Any floating point value
Returns the number rounded down to the nearest integer.
- observable - String of observable name.
Deletes the specified observable from the symbol table.
- name - Name of the view dialog.
Hides the named view dialog. Can be shown again either using showView or using the menu bar.
- [name] - Optional name of html view dialog, if more than one exists.
- html - A string of HTML code
Requires the HTML view plugin to be loaded. Will update the html content of a html view dialog.
- file - File name of script.
Loads an Eden script file from the server. The file must be on the same server as js-eden. This is a blocking load so will be slow, see includeSSI for a non-blocking and faster loading mechanism.
- file - File name of CSS code.
Loads CSS into the current session. The CSS file can be any URL, it is not restricted to the local server.
- file - File name of Javascript code.
Loads Javascript into the current session. The JS file can be any URL.