diff --git a/stack/2021010100/maxima/rtest_assessment_simpboth.mac b/stack/2021010100/maxima/rtest_assessment_simpboth.mac index 784cb4879196390990d7fb8bde760683bd65d4cf..0864edccbce091b021e110ae853ea1cd39c8335b 100644 --- a/stack/2021010100/maxima/rtest_assessment_simpboth.mac +++ b/stack/2021010100/maxima/rtest_assessment_simpboth.mac @@ -371,3 +371,5 @@ factorlist(-x^2-5*x+6); factorlist(x^3-1); [x-1,x^2+x+1]$ +cartesian_product({1, 2}, {3, 4}); +{[1, 3], [1, 4], [2, 3], [2, 4]}$ diff --git a/stack/2021010100/maxima/stack_logic.lisp b/stack/2021010100/maxima/stack_logic.lisp index 2a1e162961e1d848894b92d4424b82975f29b3e4..85b0b526073c072e7abe0b51d0c536b05a568df6 100644 --- a/stack/2021010100/maxima/stack_logic.lisp +++ b/stack/2021010100/maxima/stack_logic.lisp @@ -82,12 +82,16 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defun cartesian-product (l1 l2) - (if l1 - (append - (mapcar #'(lambda (e) (cons (car l1) e)) l2) - (cartesian-product (cdr l1) l2)) - nil)) +; maxima versions >=5.43 have an internal cartesian-product function +; incompatible with this function, therefore we only define it if +; previously undefined +(unless (fboundp 'cartesian-product) + (defun cartesian-product (l1 l2) + (if l1 + (append + (mapcar #'(lambda (e) (cons (car l1) e)) l2) + (cartesian-product (cdr l1) l2)) + nil))) (defun replicate (n e) (if (and (integerp n) (>= n 0)) diff --git a/stack/2021120900/maxima/rtest_assessment_simpboth.mac b/stack/2021120900/maxima/rtest_assessment_simpboth.mac index 51c5b03a619db18fe88b176a33aa19aa5b9cd552..ff1f51b40d8f0f2fda30958c12f7c78121fe1a3e 100644 --- a/stack/2021120900/maxima/rtest_assessment_simpboth.mac +++ b/stack/2021120900/maxima/rtest_assessment_simpboth.mac @@ -373,3 +373,5 @@ factorlist(-x^2-5*x+6); factorlist(x^3-1); [x-1,x^2+x+1]$ +cartesian_product({1, 2}, {3, 4}); +{[1, 3], [1, 4], [2, 3], [2, 4]}$ diff --git a/stack/2021120900/maxima/stack_logic.lisp b/stack/2021120900/maxima/stack_logic.lisp index 2a1e162961e1d848894b92d4424b82975f29b3e4..85b0b526073c072e7abe0b51d0c536b05a568df6 100644 --- a/stack/2021120900/maxima/stack_logic.lisp +++ b/stack/2021120900/maxima/stack_logic.lisp @@ -82,12 +82,16 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defun cartesian-product (l1 l2) - (if l1 - (append - (mapcar #'(lambda (e) (cons (car l1) e)) l2) - (cartesian-product (cdr l1) l2)) - nil)) +; maxima versions >=5.43 have an internal cartesian-product function +; incompatible with this function, therefore we only define it if +; previously undefined +(unless (fboundp 'cartesian-product) + (defun cartesian-product (l1 l2) + (if l1 + (append + (mapcar #'(lambda (e) (cons (car l1) e)) l2) + (cartesian-product (cdr l1) l2)) + nil))) (defun replicate (n e) (if (and (integerp n) (>= n 0)) diff --git a/stack/2022060100/maxima/rtest_assessment_simpboth.mac b/stack/2022060100/maxima/rtest_assessment_simpboth.mac index 51c5b03a619db18fe88b176a33aa19aa5b9cd552..ff1f51b40d8f0f2fda30958c12f7c78121fe1a3e 100644 --- a/stack/2022060100/maxima/rtest_assessment_simpboth.mac +++ b/stack/2022060100/maxima/rtest_assessment_simpboth.mac @@ -373,3 +373,5 @@ factorlist(-x^2-5*x+6); factorlist(x^3-1); [x-1,x^2+x+1]$ +cartesian_product({1, 2}, {3, 4}); +{[1, 3], [1, 4], [2, 3], [2, 4]}$ diff --git a/stack/2022060100/maxima/stack_logic.lisp b/stack/2022060100/maxima/stack_logic.lisp index 2a1e162961e1d848894b92d4424b82975f29b3e4..85b0b526073c072e7abe0b51d0c536b05a568df6 100644 --- a/stack/2022060100/maxima/stack_logic.lisp +++ b/stack/2022060100/maxima/stack_logic.lisp @@ -82,12 +82,16 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defun cartesian-product (l1 l2) - (if l1 - (append - (mapcar #'(lambda (e) (cons (car l1) e)) l2) - (cartesian-product (cdr l1) l2)) - nil)) +; maxima versions >=5.43 have an internal cartesian-product function +; incompatible with this function, therefore we only define it if +; previously undefined +(unless (fboundp 'cartesian-product) + (defun cartesian-product (l1 l2) + (if l1 + (append + (mapcar #'(lambda (e) (cons (car l1) e)) l2) + (cartesian-product (cdr l1) l2)) + nil))) (defun replicate (n e) (if (and (integerp n) (>= n 0)) diff --git a/stack/2022071300/maxima/rtest_assessment_simpboth.mac b/stack/2022071300/maxima/rtest_assessment_simpboth.mac index 51c5b03a619db18fe88b176a33aa19aa5b9cd552..ff1f51b40d8f0f2fda30958c12f7c78121fe1a3e 100644 --- a/stack/2022071300/maxima/rtest_assessment_simpboth.mac +++ b/stack/2022071300/maxima/rtest_assessment_simpboth.mac @@ -373,3 +373,5 @@ factorlist(-x^2-5*x+6); factorlist(x^3-1); [x-1,x^2+x+1]$ +cartesian_product({1, 2}, {3, 4}); +{[1, 3], [1, 4], [2, 3], [2, 4]}$ diff --git a/stack/2022071300/maxima/stack_logic.lisp b/stack/2022071300/maxima/stack_logic.lisp index 2a1e162961e1d848894b92d4424b82975f29b3e4..85b0b526073c072e7abe0b51d0c536b05a568df6 100644 --- a/stack/2022071300/maxima/stack_logic.lisp +++ b/stack/2022071300/maxima/stack_logic.lisp @@ -82,12 +82,16 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defun cartesian-product (l1 l2) - (if l1 - (append - (mapcar #'(lambda (e) (cons (car l1) e)) l2) - (cartesian-product (cdr l1) l2)) - nil)) +; maxima versions >=5.43 have an internal cartesian-product function +; incompatible with this function, therefore we only define it if +; previously undefined +(unless (fboundp 'cartesian-product) + (defun cartesian-product (l1 l2) + (if l1 + (append + (mapcar #'(lambda (e) (cons (car l1) e)) l2) + (cartesian-product (cdr l1) l2)) + nil))) (defun replicate (n e) (if (and (integerp n) (>= n 0)) diff --git a/stack/2022082900/maxima/rtest_assessment_simpboth.mac b/stack/2022082900/maxima/rtest_assessment_simpboth.mac index 51c5b03a619db18fe88b176a33aa19aa5b9cd552..ff1f51b40d8f0f2fda30958c12f7c78121fe1a3e 100644 --- a/stack/2022082900/maxima/rtest_assessment_simpboth.mac +++ b/stack/2022082900/maxima/rtest_assessment_simpboth.mac @@ -373,3 +373,5 @@ factorlist(-x^2-5*x+6); factorlist(x^3-1); [x-1,x^2+x+1]$ +cartesian_product({1, 2}, {3, 4}); +{[1, 3], [1, 4], [2, 3], [2, 4]}$ diff --git a/stack/2022082900/maxima/stack_logic.lisp b/stack/2022082900/maxima/stack_logic.lisp index 2a1e162961e1d848894b92d4424b82975f29b3e4..85b0b526073c072e7abe0b51d0c536b05a568df6 100644 --- a/stack/2022082900/maxima/stack_logic.lisp +++ b/stack/2022082900/maxima/stack_logic.lisp @@ -82,12 +82,16 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defun cartesian-product (l1 l2) - (if l1 - (append - (mapcar #'(lambda (e) (cons (car l1) e)) l2) - (cartesian-product (cdr l1) l2)) - nil)) +; maxima versions >=5.43 have an internal cartesian-product function +; incompatible with this function, therefore we only define it if +; previously undefined +(unless (fboundp 'cartesian-product) + (defun cartesian-product (l1 l2) + (if l1 + (append + (mapcar #'(lambda (e) (cons (car l1) e)) l2) + (cartesian-product (cdr l1) l2)) + nil))) (defun replicate (n e) (if (and (integerp n) (>= n 0)) diff --git a/stack/2023010400/maxima/rtest_assessment_simpboth.mac b/stack/2023010400/maxima/rtest_assessment_simpboth.mac index 51c5b03a619db18fe88b176a33aa19aa5b9cd552..ff1f51b40d8f0f2fda30958c12f7c78121fe1a3e 100644 --- a/stack/2023010400/maxima/rtest_assessment_simpboth.mac +++ b/stack/2023010400/maxima/rtest_assessment_simpboth.mac @@ -373,3 +373,5 @@ factorlist(-x^2-5*x+6); factorlist(x^3-1); [x-1,x^2+x+1]$ +cartesian_product({1, 2}, {3, 4}); +{[1, 3], [1, 4], [2, 3], [2, 4]}$ diff --git a/stack/2023010400/maxima/stack_logic.lisp b/stack/2023010400/maxima/stack_logic.lisp index 2a1e162961e1d848894b92d4424b82975f29b3e4..85b0b526073c072e7abe0b51d0c536b05a568df6 100644 --- a/stack/2023010400/maxima/stack_logic.lisp +++ b/stack/2023010400/maxima/stack_logic.lisp @@ -82,12 +82,16 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defun cartesian-product (l1 l2) - (if l1 - (append - (mapcar #'(lambda (e) (cons (car l1) e)) l2) - (cartesian-product (cdr l1) l2)) - nil)) +; maxima versions >=5.43 have an internal cartesian-product function +; incompatible with this function, therefore we only define it if +; previously undefined +(unless (fboundp 'cartesian-product) + (defun cartesian-product (l1 l2) + (if l1 + (append + (mapcar #'(lambda (e) (cons (car l1) e)) l2) + (cartesian-product (cdr l1) l2)) + nil))) (defun replicate (n e) (if (and (integerp n) (>= n 0))