This problem does not occur on the NAG version: \begin{axiom} dom:=(INT->INT) g(f:dom):dom== x+->(f(x))^2 p(x:INT):INT == x-1 \end{axiom} The next line crashes Axiom. (Here the crash is indicated by not showing the result for \begin{axiom} q:= g p \end{axiom} Below is the transcript for the NAG version: G82322 (1) -> dom:= (INT->INT) +++ |*1;g;1;G82322| redefined
(4) theMap(LAMBDA_ibs3ze_708,174) Type: (Integer -> Integer) G82322 (5) -> q 3 property change --wyscc, Fri, 04 Mar 2005 04:37:59 -0600 reply Name: #114 Maps on Function crash => #114 Map on Functions crash
We can avoid the use of an anonymous function and use
function composition to define the functional fricas dom ==> INT -> INT Type: Void
fricas g(f:dom):dom == function(x^2, Type: Void
fricas p(x:INT):INT == x-1 Type: Void
fricas q := g p fricas Compiling function p with type Integer -> Integer There are 31 exposed and 40 unexposed library operations named * having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, fricas Compiling function g with type (Integer -> Integer) -> (Integer -> Integer) Compiled code for g has been cleared. fricas Compiling function sq with type Integer -> Integer
Type: (Integer -> Integer)
fricas q 3
Type: PositiveInteger?
Take a look at FunctionalMapping? for an example of this sort thing
written in SPAD.
Thanks to both contributions and guides to use composition. However, this is a bug still since the original code works under the NAG version. We should figure out why the open source version breaks down. Afterall, anonymous functions are convenience that the system should be able to handle by assigning intermediate variables automatically.
|