Fixed bug: Multiplication of lists now work
This commit is contained in:
parent
26af3eb5ba
commit
3b253b7aca
|
@ -394,7 +394,7 @@
|
||||||
|
|
||||||
(define/memo (simplify-times ops)
|
(define/memo (simplify-times ops)
|
||||||
;(displayln (list 'simplify-times ops))
|
;(displayln (list 'simplify-times ops))
|
||||||
; the operands os are simplified
|
; the operands ops are simplified
|
||||||
; (Times op1 op2 op ...)
|
; (Times op1 op2 op ...)
|
||||||
; - n-ary, n>=2
|
; - n-ary, n>=2
|
||||||
; - no operands are products
|
; - no operands are products
|
||||||
|
@ -439,7 +439,9 @@
|
||||||
[(and (list-expression? u1) (list-expression? u2)
|
[(and (list-expression? u1) (list-expression? u2)
|
||||||
(= (length u1) (length u2)))
|
(= (length u1) (length u2)))
|
||||||
(construct
|
(construct
|
||||||
'List (append-map (λ (u1i u2i) (simplify-times-rec (list u1i u2i)))
|
'List (map
|
||||||
|
(λ (u1i u2i)
|
||||||
|
(construct 'Times (simplify-times-rec (list u1i u2i))))
|
||||||
(operands u1) (operands u2)))]
|
(operands u1) (operands u2)))]
|
||||||
[(and (list-expression? u1) (list-expression? u2))
|
[(and (list-expression? u1) (list-expression? u2))
|
||||||
; lists of different lengths => do nothing
|
; lists of different lengths => do nothing
|
||||||
|
|
Loading…
Reference in New Issue
Block a user