Operator Index


Infix operators


Special Character Operators ordered by precedence. Precendece is given as a number. The lower the number the higher the binding. Operators with identical precedence are operated from left to right.

: (20) access to self defined
. (25) access to predefined data field
° (25) degree operator
_ (50) access to element in list
^ (50) power operator
* (100) multiplication (also of vectors and matrices)
/ (100) division (also of vectors and matrices by scalars)
+ (200) addition (also of vectors and matrices by scalars)
- (200) subtraction (also of vectors and matrices by scalars, binary and unary)
! (200) logic not (unary)
== (300) equals
> (300) greater
< (300) smaller
>= (300) greater or equal
<= (300) smaller or equal
<> (300) not equal
~= (300) approximately equals
~< (300) approximately smaller
~> (300) approximately greater
~>= (300) approximately greater or equal
~<= (300) approximately smaller or equal
=:= (300) equals after evaluation
& (350) logic and
% (350) logic or
!= (350) not euqal
~!= (350) approximately not equal
.. (350) list of numbers from/to
++ (370) concat for lists
(370) list difference
~~ (370) common elements of two lists
:> (370) append element to list
<: (370) prepend element to list
= (400) variable assignment
:= (400) function definition
:=_ (400) clearing a definition
-> (400) modifyer declaration
, (500) seperator for lists and functions
; (500) separator for statements


Predefined functions


For the predefined functions in particular the arity of the functions is specified. A function may appear in several categories. Light blue functions are not yet documented.


Control structures


if (2) if operator
if (3) If/Else operator
trigger (2) Triggering a function on value change
while (2), While loop
repeat (2) repeat loop with # run-variable
repeat (3) repeat loop with explicit run-variable
forall (2) repeat loop with # run-variable
forall (3) forall loop with explicit run-variable
module (2) this operator is currently not supported
eval (1) forcing evaluation of an expression


Variable management

clear (0) clear all variables
clear (1) clear a specific variable
createvar (1) creating a local variable
removevar (1) destroying a local variable
local (arbitrary many arguments) create local variables;
release (arbitrary many arguments) remove local variables and return last value;


Arithmetic functions

sqrt (1) squareroot
exp (1) exponential function
log (1) natural logarithm
sin (1) sine function
cos (1) cosine function
tan (1) tangent function
arcsin (1) arcus sine function
arccos (1) arcus cosine function
arctan (1) arcus tangent function
arctan (2) binary arcus tangent function
add (2) addition
sub (2) subtraction
mult (2) multiplication
div (2) division
mod (2) modulo
pow (2) power
abs (1) absolute value
round (1) rounding
floor (1) closest smaller interger
ceil (1) closest larger integer
re (1) real part
im (1) imaginary part
conjugate (1) complex conjugate
random (1) random real number
randominteger (1) random integer number
random (1) random integer number
random (0) random number between 0.0 and 1.1
randombool (0) random boolean value
randomnormal (0) (0,1)-normal distributed random real value
seedrandom (1) seeding the random generator


Boolean functions

not (1), logical not
and (2) logical and
or (2) logical or
xor (2) logical exclusive or


Predicates

isinteger (1) test for integer
isreal (1) test for real number
iscomplex (1) test for complex number
iseven (1) test for even integer
isodd (1) test for odd integer
islist (1) test for list
ismatrix (1) test for nested list in matrix shape
isnumbervector (1) test for list which is a number vector
isnumbermatrix (1) test for list which is a number matrix
isstring (1) test for string
isgeometric (1) test for geometric object
isselected (1), test for being selected
ispoint (1) test for point
isline (1) test for line
iscircle (1) test for circle
isconic (1) test for conic
ismass (1) test for mass
issun (1) test for sun
isspring test for spring
isundefined (1) test for being undefined


String functions

text (1) convertes anything to a string
parse (1) takes a string and convertes it to a CindyScript expression
substring (3) substring of a string from start index to end index
replace (3) replace all occurences of a substring by another string
replace (2) pare a replacement list
tokenize (2) tokenize a string and return a list of tokens
indexof (2) first index of a substring
indexof (3) first index of a substring after position
length (1) length of a string
format (2) convert a number to a string with specified precision
guess (1) convert a number to a string guessing the numbers meaning
sort sort elements from a list, can in particular be applied to lists of strings


Elementary list operations

take (2) access to the n-th element of a list
length (1) length of a list
contains (2) predicate fpr membership
append (2) append an element to a list
prepend (2) prepend an element to a list
concat (2) concatenation of two lists
common (2) common elements of two lists
remove (2) list difference
nil (0) the empty list

Traversing lists

forall (2) forall loop with # run-variable
forall (3) forall loop with explicit run-variable
apply (2) apply a function to all elements of a list (run variable is #)
apply (3) apply a function to all elements of a list (explicit run variable)
select (2) select all elements of a list with a certain property (run variable is #)
select (3) select all elements of a list with a certain property (explicit run variable)



High-level list operations

pairs (1) list of all pairs of elements of a list
triples (1) list of all triples of elements of a list
consecutive (1) list of all pairs of consecutive elements of a list
cycle (1) list of all pairs of consecutive elements of a list, cyclically closed
reverse (1) reversing a list
set (1) removing multiple elements from a list
sort (1) sort elements from a list
sort (2) sort elements from a list by explicit function


Lists of geometric objects

allelements (0) all elements of a construction
allpoints (0) all points of a construction
alllines (0) all points of a construction
allsegments (0) all segments of a construction
allcircles (0) all circles of a construction
allconics (0) all concics of a construction
allmasses (0) all masses of a simulation
allsprings (0) all springs of a simulation


Arithmetic list operations

sum (1) sum of all list elements
sum (2) sum of function values applied to all list elements (run variable is #)
sum (3) sum of function values applied to all list elements (explicit run variable)
product (1) product of all list elements
product (2) product of function values applied to all list elements (run variable is #)
product (3) product of function values applied to all list elements (explicit run variable)
min (1) minimum of all list elements
min (2) minimum of function values applied to all list elements (run variable is #)
min (3) minimum of function values applied to all list elements (explicit run variable)
max (1) maximum of all list elements
max (2) maximum of function values applied to all list elements (run variable is #)
max (3) maximum of function values applied to all list elements (explicit run variable)


Vector and matrix operations

zerovector (1) creates a zerovector of specified length
zeromatrix (2) creates a zeromatrix of specified length
rowmatrix (1) converts a vector to a rowmatrix
columnmatrix (1) converts a vector to a columnmatrix
matrixrowcolumn (1) returns the number of rows and colums of a matrix
row (2) returns a specific row of a matrix
column (2) returns a specific columns of a matrix
submatrix (2) returns a specific minor of a matrix
transpose (1) returns the transpose of a matrix
dist (2) returns the numerical value of the distance of two vectors.
det (1) returns the determinant of a square matrix
hermiteanproduct hermitian scalar product
inverse (1) returns the inverse of a square invertible matrix
adj (1) returns the adjunct of a square matrix
eigenvalues (1) returns the eigenvalues of a square matrix
eigenvectors (1) returns the eigenvectors of a square matrix
linearsolve (2) solves a system of linear equations


Drawing functions

repaint (0) forcing a repaint of the screen;
draw (1) draw a point
draw (2) draw a segment
drawpoly (1) draw polygon from pointlist
drawpolygon (1) same as drawpoly
drawall (1) draw all elements in a list
connect (1) connect a list of points
drawtext (2), drawing a string
drawtable (2) draw a table


Function plotting

plot (1) plot a function with # run variable
plot (2) plot a function with explicit run variable
colorplot (3) plotting a region colored by the values of a function
drawfield (1) draw the flux of a vectorfiled
drawfieldcomplex (1) draw the flux of a complex function
drawforces (1) draw the flux of a forcefield
drawcurves (2) draw an oscillograph for physics


Drawing appearance

pointsize (1) set pointsize
linesize (1) set linesize
textsize (1) set textsize
pointcolor (1) set point color
linecolor (1) set line color
textcolor (1) set text color
color (1) set overall color
alpha (1) set overall alpha
gsave (0) store colors, alpha, width, and transformation to stack
grestore (0) restore colors, alpha, width, and transformation from stack


Color functions

red (1) returns a red rgb-vector
green (1) returns a green rgb-vector
blue (1) returns a blue rgb-vector
grey (1) returns a grey rgb-vector
gray (1) returns a gray rgb-vector
hue (1) returns a hue rgb-vector


Geometric transformations

translate (1) translates the global coordinate system
rotate (1) rotates the global coordinate system
scale (1) scalesthe global coordinate system
setbasis (1) sets global coordinates system to a translation basis
setbasis (2) sets global coordinates system to a similarity basis
setbasis (3) sets global coordinates system to a affine basis
setbasis (4) sets global coordinates system to a projective basis


Geometric Functions

moveto (2) move point to position
meet (2) intersection of two lines
join (2) join of two points
perp (1) perpendicular 2-dimensional vector
perp (2) perpendicular of line through point
perpendicular (2) perpendicular of line through point
para (2) parallel of line through point
parallel (2) parallel of line through point
cross (2) cross-product of two 3-dimensional vectors
dist (2) distance of two points
area (3) area of triangle given by three points
det (3) determinant of matrix of three points in homogeneous coordinates
crossratio (4) crossratio of four points
complex (1) conversion of a xy-point to a complex number
gauss (1) conversion of a complex number to xy-point
point (1) setting the geometry type of a vector to point
line (1) setting the geometry type of a vector to line
geotype (1) retrieving the geometry type of a vector
map (2) returns a transformations matrix for translations
map (4) returns a transformations matrix for similarities
map (6) returns a transformations matrix for affine transformations
map (8) returns a transformations matrix for projective transformations
pointreflect (1) returns a transformations matrix for reflection in a point
linereflect (1) returns a transformations matrix for reflection in a line
incidences (1) incidenced of a geometric object
locusdata (1) list of points on a locus





Calculus

d (2) nummerically differentiates a function
tangent(2) calculates the tangent to a function
guess (1) convert a number to a string guessing the numbers meaning
pslq (1) same as guess


Output

print (1) print a value
println (0) newline
println (1) print a value followed by newline
clearconsole (0) clears the output console
err (1) debugging printout
assert (2) conditional print for error checking
format (2) convert a number to a string with specified precision


Mouse and key input

mover (0), last moved object
mouse (0) actual mouse position in homogeneous coordinates
key (0) typed character


Time

resetclock (0) resetting the internal clock
seconds (0) seconds since last reset
simulationtime (0) time synchronized with simulation
time (0) current real world time
date (0) current real world date


Physics simulation

simulation (0) handle to simulation
force (1) probing force at a specific position
addforce (2) apply a force to a mass
setforce (2) set the force of a mass to a specific value


File IO

setdirectory (1) setting current directory
load (1) loading data from a file
import (1) importing programm code from file


Networking

openurl (1) open a specified url in a browser


Special (experimental and uncommented) operators

Use the following operators on own risc.

keys (1) list of local keys associated with an object or a variable
freevariables (1)
amsdata (0)
java (1)
curview (0)
curkernel (0)
curgraphalgorithm (0)
attribute (2) read user attribute
attribute (3) set user attribute
inspect (1) list available attributes
inspect (2) get an attribute
inspect (3) set an attribute
inspectinfo (2) information on attribute;
createpoint (2) create a point with name and position (curently not supported)
createmass (3) create a mass-point with name and position and velocity (curently not supported)
delete (1) delete a named geometric element (curently not supported)





Page last modified on Thursday 25 of May, 2006 [23:48:30 UTC].
The original document is available at http://doc.cinderella.de/tiki-index.php?page=Operator%20Index