File: arrfun.mac

package info (click to toggle)
maxima 5.21.1-2squeeze
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 94,928 kB
  • ctags: 43,849
  • sloc: lisp: 298,974; fortran: 14,666; perl: 14,325; tcl: 10,494; sh: 4,052; makefile: 2,975; ansic: 471; awk: 24; sed: 7
file content (39 lines) | stat: -rw-r--r-- 1,172 bytes parent folder | download | duplicates (3)
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
35
36
37
38
39
/*-*-Macsyma-*-*/

/* DEFAR(FOO,[X,Y],X+Y) Defines a function FOO and an array FOO.
   This allows you more flexibility than you get with straight
   macsym array functions. It is possible to reset the array
   without killing the function.  
    
   -GJC 8:54am  Friday, 5 September 1980 

*/

/* commented out of DOE MACSYMA
EVAL_WHEN([translate,batch,demo],
          IF GET('MACRO1,'VERSION) = FALSE
             THEN LOADFILE(MACRO1,FASL,DSK,SHARE),
          IF GET('SUBMAC,'VERSION) = FALSE
             THEN LOADFILE(SUBMAC,FASL,DSK,SHARE2))$ */
load("defm.mac")$

/* commented out of DOE MACSYMA
EVAL_WHEN(TRANSLATE,PACKAGEFILE:TRUE,SAVEDEF:FALSE,TRANSCOMPILE:TRUE)$ */

defar('name,'argl,'body)=>
 (name(splice(argl)):=
  block([%_val:block([?evarrp:true],declare(?evarrp,special),name[splice(argl)])],
	if %_val='?notexist then 
           (%_val:body,name[splice(argl)]:%_val,%_val)
         else %_val),
 /* kludge to init the array, (as a hashed array). */
   name[splice(argl)]:'?notexist,
   name:'name);

eval_when(demo,

defar(legend,[n],((2*n-1)*'x*legend(n-1)-(n-1)*legend(n-2))/n),

(legend[0]:rat(1), legend[1]:rat('x)));

eval_when(demo,legend(5));