Go to the first, previous, next, last section, table of contents.
Lists are the basic building block for Maxima and Lisp. All data types other than arrays, hash tables, numbers are represented as Lisp lists, These Lisp lists have the form
((MPLUS) $A 2)
to indicate an expression a+2. At Maxima level one would see
the infix notation a+2. Maxima also has lists which are printed
as
[1, 2, 7, x+y]
for a list with 4 elements. Internally this corresponds to a Lisp list of the form
((MLIST) 1 2 7 ((MPLUS) $X $Y ))
The flag which denotes the type field of the Maxima expression is a list itself, since after it has been through the simplifier the list would become
((MLIST SIMP) 1 2 7 ((MPLUS SIMP) $X $Y))
append also works on
general expressions, e.g. append (f(a,b), f(c,d,e)); yields
f(a,b,c,d,e).
Do example(append); for an example.
[x,y,z,...] where each of the list elements is an expression of
a binary operand and 2 elements. For example x=1, 2^3, [a,b] etc.
The key is checked againts the first operand. assoc returns the second
operand if the key is found. If the key is not found it
either returns the default value. default is optional
and defaults to false.
true if expr is atomic (i.e. a number, name or string) else
false. Thus atom(5) is true while atom(a[1]) and atom(sin(x)) are
false (asuming a[1] and x are unbound).
cons also works
on other expressions, e.g. cons(x, f(a,b,c)); -> f(x,a,b,c).
(%i1) delete(sin(x), x+sin(x)+y); (%o1) y + x
delete(expr_1, expr_2, n) removes the first n occurrences of
expr_1 from expr_2. If there are fewer than n
occurrences of expr_1 in expr_2 then all occurrences will be deleted.
(%i1) delete(a, f(a,b,c,d,a)); (%o1) f(b, c, d) (%i2) delete(a, f(a,b,a,c,d,a), 2); (%o2) f(b, c, d, a)
first for more details.
list followed by expr. endcons also works on general expressions, e.g.
endcons(x, f(a,b,c)); -> f(a,b,c,x).
first for more details.
first and its related functions, rest and last, work
on the form of expr which is displayed not the form which is typed on
input. If the variable inflag is set to true however, these
functions will look at the internal form of expr. Note that the
simplifier re-orders expressions. Thus first(x+y) will be x if inflag
is true and y if inflag is false (first(y+x) gives the same
results). The functions second .. tenth yield the second through the
tenth part of their input argument.
first for more details.
false if a doesn't have property i.
get evaluates its arguments.
(%i1) put (%e, 'transcendental, 'type);
(%o1) transcendental
(%i2) put (%pi, 'transcendental, 'type)$
(%i3) put (%i, 'algebraic, 'type)$
(%i4) typeof (expr) := block ([q],
if numberp (expr)
then return ('algebraic),
if not atom (expr)
then return (maplist ('typeof, expr)),
q: get (expr, 'type),
if q=false
then errcatch (error(expr,"is not numeric.")) else q)$
(%i5) typeof (2*%e + x*%pi);
x is not numeric.
(%o5) [[transcendental, []], [algebraic, transcendental]]
(%i6) typeof (2*%e + %pi);
(%o6) [transcendental, [algebraic, transcendental]]
dispform).
The length command is affected by the
inflag switch. So, e.g. length(a/(b*c)); gives 2 if
inflag is false (Assuming exptdispflag is true), but 3 if inflag is
true (the internal representation is essentially a*b^-1*c^-1).
true - if false causes any arithmetic operations
with lists to be suppressed; when true, list-matrix operations are
contagious causing lists to be converted to matrices yielding a result
which is always a matrix. However, list-list operations should return
lists.
true if expr is a list else false.
makelist (expr, i, i_0, i_1) returns a list,
the j'th element of which is equal to ev (expr, i=j)
for j equal to i_0 through i_1.
makelist (expr, x, list) returns a list,
the j'th element of which is equal to ev (expr, x=list[j])
for j equal to 1 through length (list).
Examples:
(%i1) makelist(concat(x,i),i,1,6); (%o1) [x1, x2, x3, x4, x5, x6] (%i2) makelist(x=y,y,[a,b,c]); (%o2) [x = a, x = b, x = c]
true if expr occurs as a member of list (not
within a member). Otherwise false is returned. member also works on
non-list expressions, e.g. member(b,f(a,b,c)); -> true.
first for more details.
- n elements removed if n is negative. If n is 1
it may be omitted. expr may be a list, matrix, or other expression.
reverse also works on general expressions,
e.g. reverse(a=b); gives b=a.
first for more details.
first for more details.
first for more details.
first for more details.
first for more details.
Go to the first, previous, next, last section, table of contents.