On 25 March 2015 at 23:25, Waldek Hebisch <[email protected]> wrote: > Bill Page wrote: >> it seems that since List Integer is not a Ring, map is called >> recursively on the list obtained by retract. But oddly the 2nd time >> around S = Expression Integer and R = Expression List Integer so map >> is called from FunctionSpaceFunctions2(Expression List Integer, >> Expression Expression List Integer, Expression Integer, Expression >> Expression Integer). Note: This type is not permitted in the >> interpreter but it is OK in SPAD. > > Actually 'retract r' produces a kernel. 'map' from E2 extracts > operator and argument list. Then it applies provided mapping > function to argument list. converts operator and applies > converted operator to converted argument list. Constant > kernel has 'constant' as operator and empty argument list, > so the effect is to produce 'constant' operator (with > empty argument list) in 'Expression(Integer)'. >
Thanks for the correction and explanation. > > This is also relevant to disscussion about hashing: interpeter > blindly assumes that if there is a 'map', then it is usable > for coercion. 'map' in 'ExpressionFunctions2' depends on > 'map' in 'ExpressionSpaceFunctions2' doing right thing. > But for constant kernels 'map' in 'ExpressionSpaceFunctions2' > misbehaves. One can argue that restriction in > 'ExpressionSpaceFunctions2' is reasonable, as it allows > simple implementation of useful function. But in such > case we need to make sure that users of given functionality > obey implicit contract, which is tricky to ensure. > It makes sense to remove implementation of 'map' from > 'ExpressionFunctions2' in non-Ring case, as it is likely to > fail or misbehave. Running testsuite shows no change > after removal while Ralf's example complains about missing '+'. > +1 -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/fricas-devel. For more options, visit https://groups.google.com/d/optout.
