Aleksej Saushev <a...@inbox.ru> writes:

|   Hello!
| 
| The following code brings FriCAS into Lisp debugger.
| 
| )abbrev package BUG Bug
| Bug(D: Type): Exports == Implementation where
|   Exports == with
|     dummy: D -> D
|   Implementation == add
|     iter: (D -> D, D, PositiveInteger) -> D
|     iter(f, p, 0) == p
|     iter(f, p, n) == f(iter(f, p, n-1))

[...]

| OpenAxiom's response is that this is "apparent user error":
| 
|    BUG abbreviates package Bug 
| ------------------------------------------------------------------------
|    initializing NRLIB BUG for Bug 
|    compiling into NRLIB BUG 
|    Adding $ modemaps
|    Adding D modemaps
|    Adding Integer modemaps
|    Adding NonNegativeInteger modemaps
|    Adding PositiveInteger modemaps
|    compiling local iter : (D -> D,D,PositiveInteger) -> D
|       BUG;iter is replaced by p 
| Time: 0.01 SEC.
| 
|    Adding Integer modemaps
|    Adding NonNegativeInteger modemaps
|    Adding PositiveInteger modemaps
|    compiling local iter : (D -> D,D,PositiveInteger) -> D
| ****** comp fails at level 1 with expression: ******
| ((DEF (|iter| |f| |p| |n|)
|       (NIL NIL NIL NIL)
|       (NIL NIL NIL NIL)
|       (|f| (|iter| |f| |p| (- |n| 1)))))
| ****** level 1  ******
| $x:= (DEF (iter f p n) (NIL NIL NIL NIL) (NIL NIL NIL NIL) (f (iter f p (- n 
(One)))))
| $m:= $EmptyMode
| $f:=
| ((((|iter| #) (|$Information| #) (|$DomainsInScope| # # #) (|dummy| # #) 
...)))
|  
|    >> Apparent user error:
|    redefinition of iter : (D -> D,D,PositiveInteger) -> D 
| 
| 
| I don't understand what's apparent here given that the code works when
| typed manually in, both in FriCAS and in OpenAxiom:
|
| (1) -> iter(f, p, 0) == p
|                                                                    Type: Void
| (2) -> iter(f, p, n) == f(iter(f, p, n-1))
|                                                                    Type: Void
| (3) -> iter(x+->x*2, 1, 4)
|    
|    OpenAxiom will attempt to step through and interpret the code.

The interpreter differs from the compiler in terms of the kind of codes
they accept (i.e. Spad script is very different from Spad library.)  In
the library, it is not possible to define a function piecemeal like
'iter' above.  So, the definition of iter could written in the library as


What is apparent error is that user tried to redefine the function 'iter' :-)

     iter(f, p, n) == p
       n = 0 => p
       f(iter(f, p, n-1))


-- Gaby

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
open-axiom-devel mailing list
open-axiom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open-axiom-devel

Reply via email to