1operator fun; 2 3for all t,f,nt,nf let fun( t,f,nt,nf) = 4fun_t * t + fun_f * f + fun_nt * nt + fun_nf * nf + fun_0 5$ 6 7x := fun( 1,b,c,d) ; 8y := fun( a,b,c,d) ; 9 10share t; 11 12symbolic procedure ws(u); u; 13 14symbolic procedure nil(u); u; 15 16algebraic procedure nil(u); u; 17 18for all t let fun(t,t^2)=t; 19 20for all nil let fun(nil,nil) = nil; 21 22showrules fun; 23 24for all t clear fun(t,t^2); 25 26showrules fun; 27 28for all nil clear fun(nil,nil); 29 30showrules fun; 31 32fun(t); 33 34fun(nil); 35 36% test empty variable list in declaration 37 38begin scalar; return 0 end; 39 40% test binding nil or t 41 42begin scalar nil; return nil end; 43 44begin scalar t; return t end; 45 46(lambda(t); 0)(a); 47 48(lambda(nil,t); 0)(a,b); 49 50algebraic procedure x1(t);t; 51 52x1(1); 53 54algebraic procedure x2(t); begin scalar nil; return (t+nil); end; 55 56x2(a); 57 58x2(1); 59 60%% next line commented out sine it crashes CSL 61%x2(nil); 62 63algebraic procedure y1(t); begin integer nil; return (t+nil); end; 64 65y1(1); 66 67y1(nil); 68 69algebraic procedure z1(t,u); begin t := t + u^2; return t; end; 70 71z1(1,2); 72 73z1(a,b); 74 75t(u); 76 77clear t; 78 79algebraic procedure t(x); x; 80 81t(u); 82 83t(t); 84 85t(nil); 86 87algebraic procedure nil(x); x; 88 89nil(u); 90 91nil(t); 92 93nil(nil); 94 95end; 96