|
|
|
last edited 16 years ago by Bill Page |
| 1 2 | ||
|
Editor: Bill Page
Time: 2009/10/13 16:58:25 GMT-7 |
||
| Note: update | ||
added: The follow commands are run using FriCAS \begin{axiom} )version \end{axiom} changed: -This command causes a "memory may be damaged error":: - - !\begin{axiom} - cast1(1)$CAST - \end{axiom} This command used to cause a "memory may be damaged" error:: \begin{axiom} cast1(1)$CAST \end{axiom} changed: -This command also causes a "memory may be damaged error":: - - !\begin{axiom} - cast2(1) - \end{axiom} - This command also used cause a "memory may be damaged" error:: \begin{axiom} cast2(1) \end{axiom}
This is an example of using pretend to perform a type
unsafe operation.
The follow commands are run using FriCAS
(1) -> )version
"FriCAS 1.3.12 compiled at Sat 7 Jun 23:54:49 CEST 2025"
)abbrev package CAST cast cast(): exports == implementation where
exports == with
cast1: Integer -> Float
implementation == add
cast1(i:Integer):Float == j:Float := (i pretend Float)
Compiling FriCAS source code from file
/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/76482798552469661-25px002.spad
using old system compiler.
CAST abbreviates package cast
------------------------------------------------------------------------
initializing NRLIB CAST for cast
compiling into NRLIB CAST
compiling exported cast1 : Integer -> Float
CAST;cast1;IF;1 is replaced by LETji
Time: 0 SEC.
(time taken in buildFunctor: 0)
Time: 0 SEC.
Cumulative Statistics for Constructor cast
Time: 0 seconds
finalizing NRLIB CAST
Processing cast for Browser database:
--->-->cast(constructor): Not documented!!!!
--->-->cast((cast1 ((Float) (Integer)))): Not documented!!!!
--->-->cast(): Missing Description
; compiling file "/var/aw/var/LatexWiki/CAST.NRLIB/CAST.lsp" (written 01 OCT 2025 08:47:50 AM):
; wrote /var/aw/var/LatexWiki/CAST.NRLIB/CAST.fasl
; compilation finished in 0:00:00.008
------------------------------------------------------------------------
cast is now explicitly exposed in frame initial
cast will be automatically loaded when needed from
/var/aw/var/LatexWiki/CAST.NRLIB/CASTThis command used to cause a "memory may be damaged" error::
cast1(1)$CAST
>> System error: The value 1 is not of type CONS
#include "axiom"
cast2(i: Integer): Float == {
j:Float := (i pretend Float)
}
Compiling FriCAS source code from file
/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/casta.as
using Aldor compiler and options
-O -Fasy -Fao -Flsp -lfricas -Mno-ALDOR_W_WillObsolete -DFriCAS -Y $FRICAS/algebra -I $FRICAS/algebra
Use the system command )set compiler args to change these
options.
"/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/casta.as", line 1:
#include "axiom"
^
[L1 C1] #1 (Error) Could not open file `axiom'.
The )library system command was not called after compilation.This command also used cause a "memory may be damaged" error::
cast2(1)
There are no library operations named cast2 Use HyperDoc Browse or issue )what op cast2 to learn if there is any operation containing " cast2 " in its name.
Cannot find a definition or applicable library operation named cast2 with argument type(s) PositiveInteger
Perhaps you should use "@" to indicate the required return type,or "$" to specify which version of the function you need.