From: Stavros M. <mac...@us...> - 2024-08-19 22:23:29
|
- **Comment**: The original sin seems to be with **arrayinfo**, which has weird semantics (because array evaluation has weird semantics) ~~~ ar:make_array(fixnum,2) => {Lisp Array: #(0 0)} arl:[ar] => [{Lisp Array: #(0 0)}] arrayinfo(ar) => [declared, 1, [1]] arrayinfo(arl[1]) => ERROR arrayinfo: arl[1] is not an array. ev(arrayinfo(i),i=arl[1]) => [declared, 1, [1]] block([i:arl[1]], arrayinfo(i)) => [declared, 1, [1]] arrayinfo(''ar) => ERROR arrayinfo: {Lisp Array: #(0 0)} is not an array. ~~~ That said, there is *also* something wrong with **translate** of **makelist**: ~~~ test():= block([ar,arl,i], [ ar:make_array('fixnum,2), arl:[ar], errcatch(arrayinfo(ar)), errcatch(arrayinfo(arl[1])), /* ERROR */ errcatch(ev(arrayinfo(i),i=arl[1])), errcatch(apply('arrayinfo,[ar])), /* ERROR */ errcatch(block([i:ar], arrayinfo(i))), errcatch(block([i:arl[1]], arrayinfo(i))), errcatch(makelist(arrayinfo(i),i,arl)) /* ERROR when translated only */ ] )$ test(); arrayinfo: arl[1] is not an array. arrayinfo: "{Lisp Array: #(0 0)}" is not an array. => ["{Lisp Array: #(0 0)}",["{Lisp Array: #(0 0)}"],[[declared,1,[1]]],[],[[declared,1,[1]]],[],[[declared,1,[1]]],[[declared,1,[1]]],[[[declared,1,[1]]]]] translate(test)$ test(); arrayinfo: arl[1] is not an array. arrayinfo: "{Lisp Array: #(0 0)}" is not an array. arrayinfo: i is not an array. => ["{Lisp Array: #(0 0)}",["{Lisp Array: #(0 0)}"],[[declared,1,[1]]],[],[[declared,1,[1]]],[],[[declared,1,[1]]],[[declared,1,[1]]],[]] ~~~ Maxima 5.47.0 SBCL 2.4.7 MacOS --- **[bugs:#3296] makelist differs slightly between compiler and interpreter.** **Status:** open **Group:** None **Labels:** compiler arrayinfo makelist **Created:** Mon Mar 20, 2017 06:56 AM UTC by Gunter Königsmann **Last Updated:** Mon Aug 19, 2024 08:59 PM UTC **Owner:** nobody Another response to the call for differences between compiler and interpreter in maxima. First define a list of arrays: ~~~ (%i208) arr:makelist(make_array(flonum,10),i,1,10); (arr) [Lisp array \[10\],Lisp array \[10\],Lisp array \[10\],Lisp array \[10\],Lisp array \[10\],Lisp array \[10\],Lisp array \[10\],Lisp array \[10\],Lisp array \[10\],Lisp array \[10\]] ~~~ Then try to map a function on each individual array element using makelist - which fails if this is done by compiled code: ~~~ (%i211) test(x):=makelist(arrayinfo(i),i,x); compile(test); test(arr); (%o209) test(x):=makelist(arrayinfo(i),i,x) (%o210) [test] arrayinfo: i is not an array. -- an error. To debug this try: debugmode(true); ~~~ Using interpreted code this won't fail, though: ~~~ (%i213) test(x):=makelist(arrayinfo(i),i,x); test(arr); (%o212) test(x):=makelist(arrayinfo(i),i,x) (%o213) [[declared,1,[9]],[declared,1,[9]],[declared,1,[9]],[declared,1,[9]],[declared,1,[9]],[declared,1,[9]],[declared,1,[9]],[declared,1,[9]],[declared,1,[9]],[declared,1,[9]]] (%i207) build_info(); (%o207) build_info(version="branch_5_39_base_137_g3987a2f",timestamp="2017-03-10 08:59:49",host="x86_64-pc-linux-gnu",lisp_name="CLISP",lisp_version="2.49 (2010-07-07) (built 3605577779) (memory 3698121592)") ~~~ --- Sent from sourceforge.net because max...@li... is subscribed to https://sourceforge.net/p/maxima/bugs/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/maxima/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |