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)$ */
defar('name,'argl,'body)=>
(name(splice(argl)):=
block([%_val:block([?evarrp:true],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));
|