This commit is contained in:
parent
c3acce9bab
commit
f68eb51365
|
@ -74,7 +74,8 @@
|
||||||
|
|
||||||
(define (holdable? o)
|
(define (holdable? o)
|
||||||
(and (symbol? o)
|
(and (symbol? o)
|
||||||
(memq o '(Hold))))
|
(eq? o 'Hold)
|
||||||
|
#;(memq o '(Hold))))
|
||||||
|
|
||||||
; In the BRACKET language an application of
|
; In the BRACKET language an application of
|
||||||
; a non-function evaluates to an expression.
|
; a non-function evaluates to an expression.
|
||||||
|
@ -886,14 +887,17 @@
|
||||||
true]
|
true]
|
||||||
[else (construct 'Equal (list u1 u2))]))
|
[else (construct 'Equal (list u1 u2))]))
|
||||||
|
|
||||||
(define (Expand u)
|
(define (Expand u)
|
||||||
; [Cohen, Elem, p.253]
|
; [Cohen, Elem, p.253]
|
||||||
(case (kind u)
|
(case (kind u)
|
||||||
[(Plus)
|
[(Plus)
|
||||||
(define v (Operand u 0))
|
(define v (Operand u 0))
|
||||||
#;(displayln (list u '=> v (Minus u v)))
|
; (displayln (list u '=> v (Minus u v)))
|
||||||
(Plus (Expand v)
|
(apply Plus (map Expand (operands u)))
|
||||||
(Expand (Minus u v)))]
|
; This: (Plus (Expand v) (Expand (Minus u v)))
|
||||||
|
; is used in [Cohen] but leads to an infinite loop
|
||||||
|
; when expanding (Plus 1 a (Times -1 (Plus 1 a)) x)
|
||||||
|
]
|
||||||
[(Times)
|
[(Times)
|
||||||
(define v (Operand u 0))
|
(define v (Operand u 0))
|
||||||
#;(Fix-point ; TODO: neeeded ?
|
#;(Fix-point ; TODO: neeeded ?
|
||||||
|
@ -906,7 +910,7 @@
|
||||||
(Expand-product (Expand v)
|
(Expand-product (Expand v)
|
||||||
(Expand (Quotient u v))))
|
(Expand (Quotient u v))))
|
||||||
(Expand-product (Expand v)
|
(Expand-product (Expand v)
|
||||||
(Expand (Quotient u v)))]
|
(Expand (Quotient u v)))]
|
||||||
[(Power)
|
[(Power)
|
||||||
(define base (Operand u 0))
|
(define base (Operand u 0))
|
||||||
(define exponent (Operand u 1))
|
(define exponent (Operand u 1))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user