File: basic.mac

package info (click to toggle)
maxima 5.47.0-9
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 193,104 kB
  • sloc: lisp: 434,678; fortran: 14,665; tcl: 10,990; sh: 4,577; makefile: 2,763; ansic: 447; java: 328; python: 262; perl: 201; xml: 60; awk: 28; sed: 15; javascript: 2
file content (34 lines) | stat: -rw-r--r-- 1,106 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*-*-MACSYMA-*-*/

eval_when([translate,batch,demo],
          if not(member('macro,properties(load_package))) then load(packg))$

herald_package(basic)$


/* These are basic macros, nothing in here should call anything
   complicated. PUSH and POP here are the simple version
   which do not hack once-only evaluation. 
   I might say that these macros are around mostly so
   that the code for implementing the more complicated
   macros, including the once-only stuff, can be simpler.
*/

prog1(statement1,[statements])::=
 buildq([statement1,statements,local:gensym()],
        lambda([local],splice(statements),local)(statement1))$

symbolcheck(x):=
 if symbolp(x) then x else error("arg must be a symbol",x)$

/* The functions push and pop are now defined in src/comm.lisp. 
push(c,l)::=(symbolcheck(l),buildq([c,l],l:cons(c,l)))$

pop(l)::=(symbolcheck(l),buildq([l],prog1(first(l),l:rest(l))))$
*/

/* TR_EV is a pretty sorry way to get optimization
   by Translation-time evaluation. User directed constant-folding
   you might call it. TR_EV has other uses. */

tr_ev(x)::=buildq([x],?meval(x))$