dummy1.red 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. %======================================================
  2. % Name: dummy.red - dummy indecies package
  3. % Author: A.Kryukov (kryukov@npi.msu.su)
  4. % Copyright: (C), 1993, A.Kryukov
  5. % Version: 2.10
  6. % Release: Nov. 17, 1993
  7. %======================================================
  8. module dummy1$
  9. global '(!*basis)$
  10. symbolic procedure cross(s1,s2)$ cross1(s1,s2,nil)$
  11. symbolic procedure cross1(s1,s2,w)$
  12. if null s1 then w
  13. else if car s1 memq s2
  14. then cross1(cdr s1,delete(car s1,s2),car s1 . w)
  15. else cross1(cdr s1,s2,w)$
  16. symbolic procedure suppl(s1,s2)$ suppl1(s1,s2,nil)$
  17. symbolic procedure suppl1(s1,s2,w)$
  18. if null s1 then w
  19. else if null(car s1 memq s2) then suppl1(cdr s1,s2,car s1 .w)
  20. else suppl1(cdr s1,delete(car s1,s2),w)$
  21. symbolic procedure suppl2(s1,s2,w)$
  22. if null s1 then (s2 . w)
  23. else if null(car s1 memq s2) then suppl1(cdr s1,s2,car s1 .w)
  24. else suppl1(cdr s1,delete(car s1,s2),w)$
  25. symbolic procedure tn_equal(tn1,tn2)$
  26. % tn1,tn2 - tname::=(id1 id2 ...)
  27. (car x and cdr x) where x=suppl2(tn1,tn2,nil)$
  28. symbolic procedure th_equal(th1,th2)$
  29. % th1,th2 - theader::=(tname . ilist . dlist)
  30. if tn_equal(car th1,car th2) then il_equal(cadr th1,cadr th2)
  31. else nil$
  32. symbolic procedure il_equal(il1,il2)$
  33. il_equal1(il2,suppl(il1,il2),nil)$
  34. symbolic procedure il_equal1(il,dl,w)$
  35. % il,w - ilist
  36. % dl - dlist
  37. if null il then reversip w
  38. else if null get(car il,'dummy) then il_equal1(cdr il,dl,car il . w)
  39. else ((if null cdr x
  40. then (il_equal1(cdr il,cdr dl,car dl . w)
  41. where z=rplacd(rplaca(x,car get(car dl,'dummy)),t)
  42. )
  43. else (il_equal1(cdr il,delete(z,dl),z . w)
  44. where z=dfind(car x,dl)
  45. )
  46. ) where x=get(car il,'dummy)
  47. )$
  48. symbolic procedure dfind(di,dl)$
  49. if null dl then nil
  50. else if di eq get(car dl,'dummy) then car dl
  51. else dfind(di,cdr dl)$
  52. symbolic procedure il_simp(il)$ il_simp1(il,nil)$
  53. symbolic procedure il_simp1(il,w)$
  54. if null il then reversip w
  55. else if car il memq cdr il
  56. then il_simp1(di_subst(car il . di_new car il,cdr il)
  57. ,di_new car il . w
  58. )
  59. else il_simp1(cdr il, car il . w)$
  60. symbolic procedure di_subst(x,il)$ di_subst1(x,il,nil)$
  61. symbolic procedure di_subst1(x,il,w)$
  62. if null il then reversip w
  63. else if car x eq car il then di_subst1(x,cdr il,cdr x . w)
  64. else di_subst1(x,cdr il,car il . w)$
  65. global '(d_number)$
  66. if null d_number then d_number:=0$
  67. symbolic procedure di_new(x)$
  68. begin scalar z$
  69. d_number:=d_number + 1$
  70. z:=mkid('!_,d_number)$
  71. put(z,'dummy,list x)$
  72. return z$
  73. end$
  74. global '(!*dummypri !*windexpri)$
  75. switch dummypri,windexpri$
  76. symbolic procedure di_restore il$ di_restore1(il,nil)$
  77. symbolic procedure di_restore1(il,w)$
  78. if null il then reversip w
  79. else ((if null x
  80. then ((if null y then di_restore1(cdr il,car il . w)
  81. else di_restore1(cdr il
  82. ,(if !*windexpri then mkid(car y,car il)
  83. else car y
  84. ) . w
  85. )
  86. ) where y = get(car il,'windex)
  87. )
  88. else di_restore1(cdr il
  89. ,(if !*dummypri then mkid(car x,car il) else car x) . w
  90. )
  91. ) where x=get(car il,'dummy)
  92. )$
  93. endmodule;
  94. end;