File: basic.mac

package info (click to toggle)
maxima-sage 5.45.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 113,788 kB
  • sloc: lisp: 440,833; fortran: 14,665; perl: 14,369; tcl: 10,997; sh: 4,475; makefile: 2,520; ansic: 447; python: 262; xml: 59; awk: 37; sed: 17
file content (34 lines) | stat: -rw-r--r-- 1,106 bytes parent folder | download | duplicates (7)
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))$