Next: , Previous: Sequences, Up: Marsyas Expression Syntax

##### 9.6.4.10 Function Libraries

In most cases library names can be shortened to reduce typing. For example the Real module can be reduced to R as in R.cos(1.57).

• Real (R)
• mrs_real Real.e
e = ~2.718281828
• mrs_real Real.pi
pi = ~3.141592654
• mrs_real Real.pi2
pi/2 = ~1.570796327
• mrs_real Real.pi4
pi/4 = ~0.785398163
• mrs_real Real.rpd
• mrs_real Real.dpr
• mrs_real Real.sqrt2
Square Root of 2 = ~1.414213562
• mrs_real Real.cos(mrs_real)
• mrs_real Real.acos(mrs_real)
• mrs_real Real.cosh(mrs_real)
• mrs_real Real.sin(mrs_real)
• mrs_real Real.asin(mrs_real)
• mrs_real Real.sinh(mrs_real)
• mrs_real Real.tan(mrs_real)
• mrs_real Real.atan(mrs_real)
• mrs_real Real.ln(mrs_real), mrs_real Real.log(mrs_real)
Natural logarithm, base e.
• mrs_real Real.log2(mrs_real)
Logarithm base 2.
• mrs_real Real.log10(mrs_real)
Logarithm base 10.
• mrs_real Real.sqrt(mrs_real)
Square root.
• Natural (N)
• mrs_natural Natural.randmax
Constant for the maximum random number.
• mrs_natural Natural.abs(mrs_natural)
Absolute value.
• mrs_natural Natural.rand()
Generate a random number.
• mrs_natural Natural.srand(mrs_natural)
Generate a random number using the given seed.
• mrs_natural Natural.min(mrs_natural, mrs_natural)
Return the minimum of two numbers.
• mrs_natural Natural.max(mrs_natural, mrs_natural)
Return the maximum of two numbers.
• String (S)
• mrs_natural String.len(mrs_string)
String length.
• Stream
• outstream op
Stream.op and Stream.opn support assignment. Data can be written to stdout by assigning to this object as in 3.1415 >> Stream.op or 'hello' >> Stream.op.
• outstream Stream.op(mrs_real)
write a mrs_real number to stdout.
• outstream Stream.op(mrs_natural)
write a mrs_natural number to stdout.
• outstream Stream.op(mrs_bool)
write a mrs_bool number to stdout.
• outstream Stream.op(mrs_string)
write a mrs_string number to stdout.
• outstream Stream.opn(mrs_real)
write a mrs_real number to stdout followed by a newline.
• outstream Stream.opn(mrs_natural)
write a mrs_natural number to stdout followed by a newline.
• outstream Stream.opn(mrs_bool)
write a mrs_bool number to stdout followed by a newline.
• outstream Stream.opn(mrs_string)
write a mrs_string number to stdout followed by a newline.
• Timer (Tmr)
• mrs_timer Timer.cur
the current timer that the event expression is posted on.
• mrs_string Timer.name(mrs_timer)
the name of the timer
• mrs_string Timer.type(mrs_timer)
the type of the timer
• mrs_string Timer.prefix(mrs_timer)
the prefix of the timer which is type/name
• mrs_natural Timer.time(mrs_timer)
returns the current time of the timer as a count. This is not in the form of the specific representation for the particular timer.
• mrs_bool Timer.upd(mrs_timer, mrs_string, mrs_bool)
updates a timer control value where the second parameter is the string path and the third parameter is the value
• mrs_bool Timer.upd(mrs_timer, mrs_string, mrs_real)
updates a timer control value where the second parameter is the string path and the third parameter is the value
• mrs_bool Timer.upd(mrs_timer, mrs_string, mrs_natural)
updates a timer control value where the second parameter is the string path and the third parameter is the value
• mrs_bool Timer.upd(mrs_timer, mrs_string, mrs_string)
updates a timer control value where the second parameter is the string path and the third parameter is the value
• mrs_natural Timer.ival(mrs_timer, mrs_string)
returns a natural value corresponding to the string representation of a time value in the specific format for the timer. ie "1s" may represent 1 second for a timer.