The standard library contains basic predefined combinators and functions providing backward compatibility with previous PLaSM versions.
-
AA applies fun to each element of the args sequence
Pre/Post conds (fun::isfun)(args::isseq) => (isseq)
Example aa:sqrt:< 1,4,9,16> == < 1,2,3,4> -
ABS returns the absolute value of n
Pre/Post conds (n::isnum) => (isnum)
Example abs:-5 == 5 -
AC apply-in-composition. AC:fun:seq is equivalent to (COMP ~ AA:fun):seq
Pre/Post conds (fun::isfun)(seq::isseq) => (isfun)
Example AC:SEL:< 1,2,3> == SEL:1 ~ SEL:2 ~ SEL:3 -
ACOS computes the closest to zero arc associated with a given cosine value n
Pre/Post conds (n::isnum) => (isnum)
Example acos:1 == 0 -
AL append left. appends elem on the left of seq
Pre/Post conds (elem::tt; seq::isseq) => (isseq)
Example al:< 0,< 1,2,3,4>> == < 0,1,2,3,4> -
ALIGN aligns a pair of polyhedral complexes along any given subset of coordinates.
(see Scripts 2.3.1 and 2.3.3)
Pre/Post conds (constraints::iseqof:istriple)(pol1,pol2::ispol) => (ispol)
Example align:< < 1,min,min>,< 2,min,max>>:< cuboid:< 2,2>,cuboid:< 1,1>> -
AND standard logical operation on an arbitrary sequence of logical expressions
Pre/Post conds (preds::isseqof:isbool) => (isbool)
Example and:<true,eq:<1,cos:0>,lt:0:(cos:pi)> == true -
ANIMATION is a container for animation clips and/or polyhedra and/or affine trans.
Pre/Post conds (clips::isseqof:isanimpolc) => (isanimpolc)
Example see Script 15.6.8 -
APPLY returns the result of the expression fun:value
Pre/Post conds (fun::isfun,value::tt) => (tt)
Example apply:<cat, <<1,2>,<3,4>>> == <1,2,3,4> -
AR append right. appends elem on the right of seq
Pre/Post conds (seq::isseq; elem::tt) => (isseq)
Example ar:<<1,2,3,4>,5> == <1,2,3,4,5> -
AS apply-in-sequence. AS:fun:seq is equivalent to(CONS ~ AA:fun):seq
Pre/Post conds (fun::isfun)(seq::isseq) => (isfun)
Example AS:SEL:<1,2,3> == [SEL:1, SEL:2, SEL:3] -
ASIN computes the closest to zero arc associated with a given sine value n
Pre/Post conds (n::isnum) => (isnum)
Example asin:0 == 0 -
ATAN computes the closest to zero arc associated with a given tangent value n
Pre/Post conds (n::isnum) => (isnum)
Example atan:0 == 0 -
BOTTOM locates the second argument bottom the first, by centering their xy extents
Pre/Post conds (pol1, pol2 ::ispol) => (ispol)
Example bottom:< simplex:3, cuboid:<1,1,1> > -
BOX generates the containment box of pol in the coords subspace
Pre/Post conds (coords::isseqof:isintpos)(pol::ispol) => (ispol)
Example box:< 1,2>:(simplex:4) -
BSPIZE converts the hpc representation to bsp and vice versa, thus producing a bsp
fragmentation of a non-convex pol
Pre/Post conds (pol::ispol) => (ispol)
Example bspize:pol -
C curryfies a binary function, so that, for example, fun:< a,b>, can be evaluated as
c:fun:a:b
Pre/Post conds (fun::isfun) => (isfun)
Example AA:(c:*:2)(1..10) == < 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 > -
CASE arguments are pairs < predi, funi> to be tested in sequence. If predi:x ==
true, then funi:x is evaluated; otherwise the (i + 1)-th pair is tested
Pre/Post conds (conds::isseqof:(ispred ~ s1, isfun ~ s2)(x::t) => (isfun)
Example CASE:< < LT:0,K: 1 >, < C:EQ:0,K: 2 >, < GT:0,K: 3 >>:22 == 3 -
CAT catenates a sequence of sequences, by eliminating a level of angled parenthesis
Pre/Post conds (seqs::isseqof:isseq) => (isseq)
Example cat:< < 0>,< 1,2>,< < 3,4>>,< >,< 5,6,7>> == < 0,1,2,< 3,4>,5,6> -
CATCH is used to catch a raised exception (see SIGNAL)
Pre/Post conds (and ~ [ispair,isseqof:isfun]) => (isfun)
Example def nonzero = if:< c:eq:0, signal, id>;
catch:< nonzero, k: zero >:0 == zero
catch:< nonzero, k: zero >:10 == 10 -
CEIL returns the nearest integer greater or equal than n.
Pre/Post conds (n::isnum) => (isnum)
Example ceil:2.3 == 3.0 -
CHAR maps an integer from {1,2, . . . ,255} into the corresponding ascii character
Pre/Post conds (n::(and ~ [isint,ge:1,le:255])) => (ischar)
Example char:99 == 'c' -
CHARSEQ maps a string into a sequence of characters
Pre/Post conds (str::isstring) => (isseqof:ischar)
Example charseq:'plasm' == < 'p' , 'l' , 'a' , 's' , 'm' > -
CMAP version of MAP operator used for animations
Pre/Post conds (fun::isfun)(pol::ispol) => (ispol)
Example CMAP:[s1,s2,sin~s1 * sin~s2]:dom -
COMP composition. Returns the composition of the functions in the argument sequence
Pre/Post conds (funs::isseqof:isfun) => (isfun)
Example comp:< sqrt,+>:< 4,5> == (sqrt ~ +):< 4,5> == 3 -
CONS construction. Applies a function sequence < f1, . . . ,fn> to x producing the sequence of applications < f1:x, . . . ,fn:x>. Notice the “syntactical sugar†[ ... ]
Pre/Post conds (funs::isseqof:isfun)(x::tt) => (isseq)
Example cons:< +,->:< 3,2> == [+,-]:< 3,2> == < 5,1> -
COS computes the cos trigonometric function
Pre/Post conds (n::isnum) => (isnum)
Example cos:0 == 1 -
COSH computes the hyperbolic cosine function
Pre/Post conds (n::isnum) => (isnum)
Example cosh:0 == 1.0 -
CUBOID dimension-independent interval generator. dims is the sequence of projection
sizes on coordinate directions
Pre/Post conds (dims::isseqof:isnum) => (ispol)
Example cuboid:< 1,1,1,1> == polcomplex{4,4} -
DETERMINANT evaluates the determinant of the m matrix
Pre/Post conds (m::ismat) => (isnum)
Example determinant:< < 4,2>,< 0,2>> == 8 -
DIFFERENCE computes the difference of a set of solids of the same dimension. The
operator is dimension-independent
Pre/Post conds (seq::isseqof:ispol) => (ispol)
Example difference:< pol1,pol2,pol3> == pol1 - pol2 - pol3 -
DIFFERENCEPR returns the progressive Boolean difference of a polyhedral sequence
Pre/Post conds (seq::isseqof:ispol) => (ispol)
Example differencepr:< pol1,pol2,pol3> == -
STRUCT:< pol1, pol2 - pol1, pol3- pol2 - pol1 >
DIM returns the intrinsic dimension (number of coordinates in a chart) of pol
Pre/Post conds (pol::ispol) => (isint)
Example dim:(simplex:2) == 2 -
DISTL distribute left. Returns the pair sequence with x and the elements of seq
Pre/Post conds (x::tt,seq::isseq) => (isseqof:ispair)
Example distl:< x,< 1,2,3>> == < < x,1>,< x,2>,< x,3>> -
DISTR distribute right. Returns the pair sequence with the elements of seq and x
Pre/Post conds (seq::isseq,x::tt) => (isseqof:ispair)
Example distr:< < 1,2,3>,x> == < < 1,x>,< 2,x>,< 3,x>> -
DIV n-ary left-associative division. It is an alias for “/â€
Pre/Post conds (nums::isseqof:isnum) => (isnum)
Example /:< 20> == div:< 20> == 1/20
20 / 2 == 20 div 2 == div:< 20,2> == 10
20 / 5 / 2 == /:< 20,5,2> == div:< 20,5,2> == 2 -
DOWN locates the second argument down the first (along the x2 coordinate).
Equivalent to align:< < 1,min,min>,< 2,min,max>>
Pre/Post conds (pol1, pol2 ::ispol) => (ispol)
Example down:< cuboid:< 1,1,1>, cuboid:< 2,2,2>> -
DUMP prints a face-based representation of pol in the listener
Pre/Post conds (pol::ispol) => (isstring)
Example DUMP:(CUBOID:< 1,1,1>) -
DUMPREP prints a pol representation, face-based if rep = 1, vertices-based if rep = 0
Pre/Post conds (pol::ispol)(rep::or ~ [c:eq:0, c:eq:1]) => (isstring)
Example DUMP:(CUBOID:< 1,1,1>):0 -
EMBED embeds a d-polyhedron into the subspace xd+1 = · · · = xd+n = 0 of IEd+n
Pre/Post conds (n::isintpos)(pol::ispol) => (ispol)
Example ([dim,rn] ~ embed:1 ~ cuboid):< 1,1> == < 2,3> -
EQ predicate, testing for equality of all values in the argument sequence
Pre/Post conds (or ~ aa:(or ~ [isnum, isbool, ischar, isstring, isfun])) => (isbool)
Example 4 eq len:< 1,2,3,4> == eq:< 4,len:< 1,2,3,4>> == true
eq:< 4, 5 - 1, 3+ 1, 2 * 2, 8 / 2> == true
eq:< char:56, '8' > == true
eq:< 4> == true -
EXP exponential. Computes the function IR => IR : x => ex
Pre/Post conds (x::isnum) => (isnum)
Example exp:1 == 2.718281828459045 -
EXPORT exports a geometric value to a vrml file
Pre/Post conds (pol::ispol)(filename::isstring) => (ispol)
Example VRML:(cuboid:< 2,2,2>): out.wrl ; -
FALSE primitive logical value
Pre/Post conds => (isbool)
Example and:< false,gt:0:1> == false -
FIRST returns the first element of the sequence given as argument.
Pre/Post conds (seq::and ~ [isseq,not ~ isnull]) => (tt)
Example first:< < 1,2>,< 3,4>,< 5,6>> == < 1,2> -
FLASH exports a 2D pol within a drawing area of width pixels, in a .swf file
Pre/Post conds (pol::ispol)(width::isintpos)(filename::isstring) => (ispol)
Example flash:(cuboid:< 2,2>):200: path/out.swf -
FLASHANIM exports a 2D clip to a .swf file, with a given width and framerate
Pre/Post conds (clip::isseqof:ispol)(width::isintpos)(filename::isstring)
(framerate::isintpos) => (ispol)
Example see Script 15.3.3 -
FLOOR returns the nearest integer less or equal to x
Pre/Post conds (x::isnum) => (isint)
Example floor:pi == 3 -
FRAME creates a static object rendered within the [start,end] animation time
Pre/Post conds (pol::ispol)(start,end::isnum) => (isanimpol)
Example FRAME:(CUBOID:< 1,1,1>):< 2,5> -
FROMTO returns the integer sequence from m to n. Empty if m > n. Alias for ..
Pre/Post conds (m,n::isint) => (isseqof:isint)
Example fromto:< 1,4> == 1 .. 4 == < 1,2,3,4> -
GE predicate testing if the second argument n is greater or equal than m
Pre/Post conds (m::isnum)(n::isnum) => (isbool)
Example ge:5.2:5.3 == true -
GT predicate testing if the second argument n is greater than m
Pre/Post conds (m::isnum)(n::isnum) => (isbool)
Example gt:2:pi == true -
HELP prints a help screen within the listener
Pre/Post conds (a::tt) => (tt)
Example help:0 -
ID returns the arg argument unchanged
Pre/Post conds (arg::tt) => (tt)
Example id:7 == 7 -
IF It is applied to a triplet of functions, where pred is a predicate specifying the conditional behavior with respect to x
Pre/Post conds (pred, then, else::isfun)(x::tt) => (tt)
Example if:< gt:0, sqrt, k:0>:9 == 3; if:< gt:0, sqrt, k:0>:-9 == 0 -
INSL insert left combinator, allowing to apply a binary operator f to n arguments:
insl:f:< x1, . . . ,xn−1,xn> == f:< insl:f:< x1, . . . ,xn−1>, xn>
Pre/Post conds (f::isfun)(args::and ~ [isseq,not~isnull]) => (tt)
Example insl:**:< 2,2,3> == 4**3 == 64 -
INSR insert right combinator, allowing to apply a binary operator f to n arguments:
insr:f:< x1, . . . ,xn−1,xn> == f:< x1, insr:f:< x2, . . . ,xn>>
Pre/Post conds (f::isfun)(args::and ~ [isseq,not~isnull]) => (tt)
Example insr:**:< 2,2,3> == 2**8 == 256 -
INTERSECTION computes the intersection of a set of solids of the same dimension. The operator is dimension-independent
Pre/Post conds (seq::(and~[isseqof:ispol,eq~aa:dim,and~aa:(eq~[dim,rn])]))
=> (ispol)
Example intersection:< cuboid:< 0.8,0.8>, simplex:2> -
INTSTO integers to. The operator returns either the sequence 1 .. n if 0 < n, or the
sequence -1 .. n if n < 0, or the empty sequence if n = 0
Pre/Post conds (n::isint) => (isseqof:isint)
Example intsto:6 == < 1,2,3,4,5,6> -
INV matrix inversion returns the inverse matrix of m.
Pre/Post conds (m::(and~[ismat, eq~[len,len~s1]])) => (ismat)
Example inv:< < 1,2>,< 2,0>> == < < 0,1/2>,< 1/2,-1/4>> -
ISANIMPOL predicate that tests if arg is an animated polyhedral complex
Pre/Post conds (arg::tt) => (isbool)
Example isanimpol:(cuboid:< 2,2,2>) == false -
ISBOOL predicate that tests if arg is a Boolean expression
Pre/Post conds (arg::tt) => (isbool)
Example isbool:(eq:< 3+1,5-2>) == true -
ISCHAR predicate that tests if arg is a character
Pre/Post conds (arg::tt) => (isbool)
Example ischar:'a' == true -
ISEMPTY predicate that tests if a geometric value is empty
Pre/Post conds (pol::ispol) => (isbool)
Example isempty:(-:< cuboid:< 2,2>,< cuboid:< 2,2>>) == true -
ISFUN predicate that tests if arg is a function
Pre/Post conds (arg::tt) => (isbool)
Example isfun:cons == true -
ISINT predicate that tests if arg is an integer
Pre/Post conds (arg::tt) => (isbool)
Example isint:10 == true -
ISINTNEG predicate that tests if arg is a negative integer
Pre/Post conds (arg::tt) => (isbool)
Example isintneg:-7 == true -
ISINTPOS predicate that tests if arg is a positive integer
Pre/Post conds (arg::tt) => (isbool)
Example isintpos:4 == true -
ISNULL predicate that tests if arg is the empty sequence
Pre/Post conds (arg::tt) => (isbool)
Example isnull:< > == true -
ISNUM predicate that tests if arg is a number
Pre/Post conds (arg::tt) => (isbool)
Example isnum:pi == true -
ISNUMNEG predicate that tests if arg is a negative number
Pre/Post conds (arg::tt) => (isbool)
Example isnumneg:-12.7 == true -
ISNUMPOS predicate that tests if arg is a positive number
Pre/Post conds (arg::tt) => (isbool)
Example isnumpos:12.7 == true -
ISPAIR predicate that tests if arg is a pair (a sequence of exactly two elements)
Pre/Post conds (arg::tt) => (isbool)
Example ispair:< +,-> == true -
ISPOL predicate that tests if arg is a geometric value
Pre/Post conds (arg::tt) => (isbool)
Example ispol:(simplex:1) == true -
ISREAL predicate that tests if arg is a real number
Pre/Post conds (arg::tt) => (isbool)
Example isreal:0.45 == isreal:4.5e-1 == true -
ISREALNEG predicate that tests if arg is a negative real number
Pre/Post conds (arg::tt) => (isbool)
Example isrealneg:-5.4 == true -
ISREALPOS predicate that tests if arg is a positive real number
Pre/Post conds (arg::tt) => (isbool)
Example isrealpos:pi == true -
ISSEQ predicate that tests if arg is a sequence
Pre/Post conds (arg::tt) => (isbool)
Example isseq:< id,cons> == true -
ISSEQOF second-order predicate that tests if arg is a sequence with all elements of
pred type
Pre/Post conds (pred::isfun)(arg::tt) => (isbool)
Example isseqof:isint:< 2,4,5.01> == false -
ISSTRING predicate that tests if arg is a string
Pre/Post conds (arg::tt) => (isbool)
Example isstring: PLaSM == true -
JOIN returns the convex hull of a sequence of geometric values in IEn
Pre/Post conds (seq::or ~ [isseqof:ispol, ispol]) => (ispol)
Example join:< (embed:1 ~ cuboid):< 1,1>, simplex:3> -
K constant functional that always returns the first argument, for any value of the
second one
Pre/Post conds (a::tt)(b::tt) => (tt)
Example k:< 1,2>:100 == < 1,2> -
LAST returns the last element of the non-empty sequence argument
Pre/Post conds (sequence::and ~ [isseq,not ~ isnull]) => (tt)
Example last:< < 1,2>,< 3,4>,< 5,6>> == < 5,6> -
LE predicate that tests if the second argument n is less or equal than m
Pre/Post conds (m::isnum)(n::isnum) => (isbool)
Example le:2:(PI - 2) == true -
LEFT locates the second argument on the left of the first (along the x1 coordinate)
Pre/Post conds (pol1, pol2 ::ispol) => (ispol)
Example left:< cuboid:< 1,1,1>, cuboid:< 2,2,2>> -
LEN returns the length of the sequence given as argument
Pre/Post conds (sequence::isseq) => (isint)
Example len:< 2,5,2,1> == 4 -
LESS predicate that tests if the argument is a sequence of increasing numbers
Pre/Post conds (nums::isseqof:isnum) => (isbool)
Example less:< 1,2,3> == true -
LESSEQ predicate that tests if the argument is a sequence of non-decreasing numbers
Pre/Post conds (nums::isseqof:isnum) => (isbool)
Example lesseq:< 1,2,2,3> == true -
LIFT combining form with semantics
lift:f:< f1, . . . , fn> == f ~ [f1, . . . , fn]
Pre/Post conds (f::isfun)(funs::isseqof:isfun) => (isfun)
Example lift:+:< sin,cos> == + ~ [sin,cos] -
LIST returns the sequence containing arg. Alias for [id]
Pre/Post conds (arg::tt) => (isseq)
Example list:4 == < 4> -
LN natural logarithm loge of a positive real x
Pre/Post conds (x::isrealpos) => (isreal)
Example DEF e = (+ ~ aa:(c:/:1.0 ~ fact)):(0..20); ln:1 = 0; ln:e = 1; -
LOAD loads a script file within the run-time PLaSM environment
Pre/Post conds (filename::isstring)) => (side effect)
Example load: ~/Documents/example.psm -
LOADLIB loads the library file passed as argument. Let us use no file extension
Pre/Post conds (filename::isstring) => (side effect)
Example loadlib: psmlib/curves -
LOOP generates times repetitions of an animation
Pre/Post conds (times::isintpos)(anim::isanimpolc) => (isanimpol)
Example def movie = loop:10:(animation:< clip1, clip2>); -
LT predicate that tests if the second argument m is less than n
Pre/Post conds (n::isnum)(m::isnum) => (isbool)
Example lt:5:2 == true -
MAP simplicial mapping. It maps a (possibly CONSed) sequence of coordinate funs over a polyhedral domain. A simplicial decomposition is automatically generated
Pre/Post conds (funs::or ~ [isseqof:isfun, isfun])(domain::ispol) => (ispol)
Example map:< cos ~ s1,sin ~ s1>:((quote ~ #:32):(2*pi/32)) -
MAT generates a tensor (bijective transformation function) from its invertible matrix with first row and column homogeneous. Dimension independent operator
Pre/Post conds (m::issqrmat) => (isfun)
Example def rot2d = mat ~ mathom ~ [[cos,- ~ sin],[sin,cos]]; rot2d:(pi/4):(cuboid:<1,1>);
-
MAX returns the maximum values achieved by pol on coords coordinates
Pre/Post conds (coords::isseqof:isintpos)(pol::ispol) => (isseqof:isnum)
Example max:< 1,3>:(cuboid:< 2,4,6>) == < 2.0,6.0> -
MED returns the medium values achieved by pol on coords coordinates
Pre/Post conds (coords::isseqof:isintpos)(pol::ispol) => (isseqof:isnum)
Example med:< 1,3>:(cuboid:< 2,4,6>) == < 1.0,3.0> -
MERGE merging of two ordered sequences seqs using the binary predicate pred
Pre/Post conds (pred::isfun)(seqs::and ~ [isseq,not ~ isnull]) => (isseq)
Example merge:less:< < 1,3,4,5>,< 2,4,6,8>> == < 1,2,3,4,4,5,6,8 > -
MIN returns the minimum values achieved by pol on coords coordinates
Pre/Post conds (coords::isseqof:isintpos)(pol::ispol) => (isseqof:isnum)
Example min:< 1,2>:(cuboid:< 2,4,6>) == < 0.0,0.0> -
MKPOL is a mapping from triples of number sequences to polyhedral complexes: mkpol:< verts, cells, pols >, where verts are points in IEd (given as sequences of coordinates); cells are convex cells (given as sequences of point indices); pols are polyhedra (given as sequences of cell indices). Each cell is the convex hull of its vertices, each polyhedron is the set union of its cells
Pre/Post conds (verts::ismatof:isreal; cells,pols::AND ~ AA:(isseqof:isintpos)) => (ispol)
Example mkpol:< < < 0,0>,< 0,1>,< 1,1>,< 1,0>>, < < 1,2,3,4>>,< < 1>>> -
MOVE basic primitive for configuration space (cs) sampling animation. Is applied to: (a) geometry generator function of real parameters (degrees of freedom); (b) sequence of cs points; (c) increasing sequence of time values, s.t.
len:cspoints == len:timepoints
Pre/Post conds (geometry::isfun)(cspoints::or ~ [iseqof:isreal,ismatof:isreal])
(timepoints::isseqof:isrealpos) => (isanimpol)
Example def obj(x,a::isreal) = (t:1:x ~ r:< 1,2>:a):(cuboid:< 1,1>);
def clip = move:obj:< < 0,0>,< 5,pi>,< 5,0>>:< 0,1,2>; -
NEQ predicate, testing the non-equality of all values in the argument sequence
Pre/Post conds (or ~ aa:(or ~ [isnum,isbool,ischar,isstring,isfun]))
=> (isbool)
Example neq:< 4, 5 - 1, 3+ 1, 2 * 2, 8 / 2> == false -
NOT standard unary logical operation on logical values. Actually, it considers every PLaSM value as true but < >
Pre/Post conds (a::tt) => (isbool)
Example not:false == true -
OPEN restores a geometric object from a .xml file (see SAVE)
Pre/Post conds (filename::isstring) => (ispol)
Example def cube = open: path/cube.xml ; -
OR standard logical operation between arguments with logical values
Pre/Post conds (preds::isseqof:isbool) => (isbool)
Example or:< false,(not ~ eq):< 1,2>> == true -
ORD maps an ascii character into its ordinal value, i.e. its index in the ascii table
Pre/Post conds (c::ischar) => (and ~ [isintpos,le:255])
Example ord:'c' == 99, ord:'\t' == 9, ord:' ' == 32 -
PI constant value. PLaSM denotation of π
Pre/Post conds => (isnum)
Example pi == 3.14159265358979 -
PRINT returns arg and prints its value in the listener. It may be used to debugging
Pre/Post conds (arg::tt) => (tt)
Example (@1 ~ print ~ embed:1 ~ print ~ simplex):2 -
QUOTE transforms non-empty sequences of non-zero reals into 1D polyhedra. Positive numbers produce solid segments; negative numbers are used as translations
Pre/Post conds (nums::and ~ [isseqof:isnum, and ~ aa:(c:neq:0)]) => (ispol)
Example quote:< 2,-10,1,1,-10,2> -
R dimension-independent rotation tensor. coords are the indices of the coordinate pair affected by the transformation. The rotation angle is given in radians
Pre/Post conds (coords::and ~ [ispair, isseqof:isintpos])
(angle::isnum)(pol::or ~ [ispol,isanimpol])
=> (or ~ [ispol,isanimpol])
Example r:< 1,2>:(pi/4):(cuboid:< 10,10,10>) -
RAISE this combinating form is used to overload operators over both numbers and functions. In fact
RAISE:f:seq == IF:< IsSeqOf:IsFun, LIFT:f, f>:seq
Pre/Post conds (f::isfun)(args::isseq) => (isfun)
Example raise:+:< +,*> == + ~ [+,*] -
RANGE returns the integer sequence (possibly reversed) from m to n
Pre/Post conds (m,n::isint) => (isseq)
Example range:< 5,-1> == < 5,4,3,2,1,0,-1> -
REVERSE returns a sequence in reverse order
Pre/Post conds (seq::isseq) => (isseq)
Example reverse:< < 1,2>,< 3,4>,< 5,6>> == < < 5,6>,< 3,4>,< 1,2>> -
RIGHT locates the second argument on the right of the first (along the x1 coordinate)
Pre/Post conds (pol1, pol2 ::ispol) => (ispol)
Example right:< cuboid:< 1,1,1>, cuboid:< 2,2,2>> -
RN returns the embedding dimension, i.e. the number of coordinates of points
Pre/Post conds (pol::ispol) => (isintpos)
Example (rn ~ embed:2 ~ simplex):3 == 5 -
S dimension-independent scaling tensor. coords are the indices of coordinates affected by the transformation
Pre/Post conds (coords::or ~ [isintpos, isseqof:isintpos]) (params::or ~
[isnum, isseqof:isnum]) (pol::or ~ [ispol,isanimpol])
=> (or ~ [ispol,isanimpol])
Example s:< 1,2>:< 0.5,-1.5>:(cuboid:< 10,10,10>) -
SAVE stores a geometric value into an xml file
Pre/Post conds (pol::ispol)(filename::isstring) => (ispol)
Example save:(cuboid:< 1,1,1>): /path/cube.xml -
SEL returns the i-th element of seq sequence. An exception is raised if i > len:seq
Pre/Post conds (i::isintpos)(seq::isseq) => (tt)
Example sel:2:< < 1,2>,< 3,4>,< 5,6>> == < 3,4> -
SHIFT shifts the beginning of the animation clip of t seconds
Pre/Post conds (t::isnum)(clip::isanimpolc) => (isanimpol)
Example shift:10:clip -
SHOWPROP returns the sequence of < property,value> pairs associated with obj
Pre/Post conds (obj::ispol) => (isseqof:ispair)
Example showprop:(cuboid:< 1,1> color red) == < < ’RGBcolor’,< 1,0,0>>> -
SIGN returns either 1 if x is positive, or -1 if x is negative, or 0 if x is zero
Pre/Post conds (x::isnum) => (isint)
Example sign:-4.5 == -1 -
SIGNAL raises an exception, to be captured by the CATCH primitive
Pre/Post conds (value::tt) => (exception)
Example def nonzero = if:< c:neq:0, id, signal>;
nonzero:0 == plasm exception: 0 (message in the listener)
catch:< nonzero, k: nonzero >:0 == nonzero -
SIMPLEX generator of the simplex σd == conv ({ei} ∪ {0}) ₠IRd, 1 ≠i ≠d
Pre/Post conds (d::isnat) => (ispol)
Example simplex:5 -
SIN computes the sin trigonometric function. The argument is in radians
Pre/Post conds (alpha::isnum) => (isnum)
Example sin:(pi/2) == 1.0 -
SINH computes the hyperbolic sine of x
Pre/Post conds (x::isnum) => (isnum)
Example sinh:0 == 0.0 -
SIZE return the size of the pol projection/s on the specified coordinate direction/s
Pre/Post conds (coords::or ~ [isintpos,isseqof:isintpos])(pol::ispol)
=> (or ~ [isrealpos, isseqof:isrealpos])
Example (size:2 ~ cuboid):< 2,4,6> == 4.0 -
SQRT square root operator. Negative arguments are allowed
Pre/Post conds (x::isnum) => (isnum)
Example sqrt:64 == 8; sqrt:-64 == 0+8i -
STRING maps a sequence of characters into a string
Pre/Post conds (chars::isseqof:ischar) => (isstring)
Example string:< 'c' , 'a' , 'd' > == 'cad' -
STRUCT constructor of hierarchical assemblies
Pre/Post conds (args::isseqof:(or ~ [ispol, isanimpol, isfun]))
=> (or ~ [ispol, isanimpol])
Example struct:< cuboid:< 2,2>, t:1:3:, simplex:2> -
SVG exporter of a 2D geometric value pol into a canvas of width pixels in a .svg file
Pre/Post conds (pol::ispol)(width::isnum)(filename::isstring) => (ispol)
Example svg:(cuboid:< 1,1>):250: out.svg -
T dimension-independent translation tensor. coords are the indices of the
coordinates affected by the transformation
Pre/Post conds (coords::or ~ [isintpos,isseqof:isintpos])
(params::or ~ [isnum,isseqof:isnum])
(pol::or ~ [ispol,isanimpol]) => (or ~ [ispol,isanimpol])
Example t:< 1,2>:< -5,-5>:(cuboid:< 10,10>) -
TAIL returns the non-empty argument sequence but its first element
Pre/Post conds (seq::and ~ [isseq,not ~ isnull]) => (isseq)
Example tail:< < 1,2>,< 3,4>,< 5,6>> == < < 3,4>,< 5,6>> -
TAN computes the tan trigonometric function. The argument is in radians
Pre/Post conds (alpha::isnum) => (isnum)
Example tan:(pi/4) == 1 -
TANH computes the hyperbolic tangent of the argument
Pre/Post conds (x::isnum) => (isnum)
Example tanh:0 == 0 -
TIME returns information about the execution time of the function argument
Pre/Post conds (f::isfun) => (tt)
Example time:cuboid:< 1,1,1> -
TOP locates the second argument over the first (z dir), by centering their xy extents
Pre/Post conds (pol1, pol2 ::ispol) => (ispol)
Example top:< cuboid:< 1,1,0.5> color red, cuboid:< 1,1,0.5> color blue> -
TRANS transposes a sequence of sequences of the same length. The elements may be
of arbitrary type
Pre/Post conds (seq::ismat) => (ismat)
Example trans:< < 1,2>,< 3,4>,< 5,6>> == < < 1,3,5>,< 2,4,6>> -
TREE recursively applies a binary function f to a sequence of arguments arg
Pre/Post conds (f::isfun)(args::and ~ [isseq,not ~ isnull]) => (tt)
Example def bigger (a,b::isreal) = if:< greater, s1, s2 >:< a,b>;
def biggest (seq::isseqof:isnum) = tree:bigger:seq;
biggest:< 8,2,4,2,3,11,-5> == 11 -
TRUE a truth value. Primitive PLaSM value
Pre/Post conds => (isbool)
Example and:< true, gt:1:0> == false -
TT constant predicate that returns true for every argument. Alias for k:true
Pre/Post conds (arg::tt) => (isbool)
Example tt:cons == true; tt:1000 == true; tt: aaa == true; -
UKPOL UnmaKe POLyhedron. Inverse operator of MKPOL (see). Returns pol represented as a triplet of vertices, convex and polyhedral cells
Pre/Post conds (pol::ispol) => (isseqof:isseq)
Example ukpol:(cuboid:< 1,1>) == < < < 0.0, 1.0>, < 1.0, 1.0>, < 0.0, 0.0>, < 1.0, 0.0>>, < < 1, 2, 3, 4>>, < < 1>>> -
UKPOLF unmake polyhedron by faces. Returns the internal representation by faces as a triplet < covectors, cells, pols>. Covectors are normalized
Pre/Post conds (pol::ispol) => (iseqof:isseq)
Example ukpolf:(cuboid:< 1,1>) == < < < 1.0, 0.0, 0.0>, < -0.7071, 0.0,
0.7071>, < 0.0, 1.0, 0.0>, < 0.0, -0.7071, 0.7071>>, < < 1, 2, 3, 4>>, < < 1>>> -
UNION of a set of solids of the same dimension. More expensive than the + operator, but produces a well defined cellular result
Pre/Post conds (args::isseqof:ispol) => (ispol)
Example (@1 ~ union ~ [id, t:< 1,2>:< 0.5,0.5>] ~ cuboid):< 1,1,1> -
UP locates the second argument over the first (along the x2 coordinate)
Pre/Post conds (pol1, pol2 ::ispol) => (ispol)
Example up:< cuboid:< 1,1,1>, cuboid:< 2,2,2>> -
VRML exports a geometric value into a vrml file with suffix .wrl
Pre/Post conds (pol::ispol)(filename::isstring) => (ispol)
Example vrml:(cuboid:< 2,2,2>): out.wrl ; -
WARP time scaling operator used for animations Pre/Post conds (s::isnum)(anim::isanimpol) => (isanimpol)
Example (shift:10 ~ warp:-1):clip -
WITH binary operator used to dynamically annotate a geometric value with pairs < property,values>, where property is a string
Pre/Post conds (pol::ispol; prop val:: and ~ [ispair, isstring ~ s1, tt ~ s2]) => (tt)
Example cuboid:< 1,1> with < RGBcolor ,< 1,0,0> > -
XOR Boolean xor (union minus intersection) of a sequence of geometric values
Pre/Post conds (args::isseqof:ispol) => (ispol)
Example xor:< cuboid:< 3,3,3>, t:< 1,2>:< 0.5,0.5>:(cuboid:< 3,3,3>)> -
- n-ary difference operator between (a) numbers, (b) functions, (c) matrices and (d) geometric values
Pre/Post conds (args::lift:or:(AA:isseqof:< isnum, isfun, ismat, ispol>))
=> (or ~ [isnum,isfun,ismat,ispol])
Example 2 - 3 .5 - 1 == -:< 2, 3.5, 1 > == 0.5
(sin - cos):PI == (- ~ [sin,cos]):PI == 1.0
idnt:2 - < < 1,1>,< 1,1>> == < < 0,-1>,< -1,0>>
(id - t:< 1,2>:< 0.5,0.5>):(cuboid:< 3,3,3>) == PolComplex< 3,3> -
# repetition operator. Returns a sequence with n repetitions of arg
Pre/Post conds (n::isintpos)(arg::tt) => (isseq)
Example #:4:true == < true,true,true,true> -
## sequence repetition operator. ##:n:seq is equivalent to (cat ~ #:n):seq
Pre/Post conds (n::isintpos)(seq::isseqof:tt) => (isseq)
Example ##:3:< 1,2> == cat:(#:3:< 1,2>) == < 1,2,1,2,1,2> -
& n-ary Boolean intersection operator
Pre/Post conds (seq::isseqof:ispol) => (ispol)
Example &:< cuboid:< 0.8,0.8,0.8>, simplex:3> -
&& binary intersection of extrusions. The args are properly embedded into coords subspaces, indefinitely extruded and pair-wise intersected
Pre/Post conds (coords::isseqof:isint)(args::isseqof: ispol) => (ispol)
Example -
* n-ary product operator between (a) numbers, (b) functions, (c) matrices and (d) geometric values
Pre/Post conds (args::lift:or:(AA:isseqof:< isnum, isfun, ismat, ispol>))
=> (or ~ [isnum,isfun,ismat,ispol])
Example *:< 20,5,2> == 200
(sin * cos):PI == (* ~ [sin,cos]):PI == 0.0
< < 4,2>,< 2,1>> * < < 1,1>,< 0,2>> == < < 4,8>,< 2,4>>
simplex:2 * Q:1 == PolComplex{3,3} -
** power raising. Mathematical operator
Pre/Post conds (base,exp::isnum) => (isnum)
Example **:< 2,3> == 8.0; 81 ** (1/2) == 9.0 -
.. generator of the integer sequence from m to n. Alias for fromto
Pre/Post conds (m,n::isint) => (isseqof:isint)
Example -1 .. 4 == < -1,0,1,2,3,4> -
/ n-ary division operator between numbers and functions
Pre/Post conds (args::lift:or:(AA:isseqof:< isnum, isfun, ispol>))
=> (or ~ [isnum,isfun,ispol])
Example /:< 20,5,2> == 2 -
ˆ evaluates the Boolean xor of a sequence of geometric values. It is less time-consuming than the xor operator, but returns a "weak" complex
Pre/Post conds (seq::isseqof:ispol) => (ispol)
Example (@1 ~ ˆ ~ [id, t:< 1,2>:< 0.5,0.5>] ~ cuboid):< 3,3,0.5> -
~ function composition operator. Alias for n-ary COMP
Pre/Post conds (funs::isseqof:isfun) => (isfun)
Example (sqrt ~ +):< 4,5> == 3 -
+ n-ary addition operator between (a) numbers, (b) functions, (c) matrices and (d)< geometric values (as union)
Pre/Post conds (args::lift:or:(AA:isseqof:< isnum, isfun, ismat, ispol>))
=> (or ~ [isnum,isfun,ismat,ispol])
Example +:< 5,2,1> == 8
(sin + cos):PI == (+ ~ [sin,cos]):PI == -1.0
< < 4,2>,< 2,1>> + < < 1,1>,< 0,2>> == < < 5,3>,< 2,3>>
cuboid:< 3,3,3> + t:< 1,2>:< 0.5,0.5>:cuboid:< 3,3,3> -
@n returns the n-dimensional skeleton of a complex
Pre/Post conds (pol::ispol) => (ispol)
Example @1:(cuboid:< 0.8,0.8,0.8> & simplex:3) == PolComplex{1,3}