axiom-mail
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Axiom-mail] Help with AXIOM


From: themos
Subject: Re: [Axiom-mail] Help with AXIOM
Date: Thu, 8 Jan 2004 17:28:48 +0100 (BST)

On Thu, 8 Jan 2004, Elias P. TSIGARIDAS wrote:

>
> Hello to all and happy new year
>
>
> I have some questions about axiom
>
> Can anyone tell me how to open a file and read some values from it?

NOTE:The following works on the last commercial version of AXIOM - don't
know about the free version.



Text can be read in using the facilities provided by domain TextFile

example:

(1) -> tf:TextFile := open("/etc/motd")

   (1)  "/etc/motd"
                                                          Type: TextFile
(2) -> read! tf

   (2)  "Have a lot of fun..."
                                                          Type: String


conversions from String to Integer are provided by the package
NumberFormats

To store and retrieve values of a particular domain S, use domain File(S)

To do the same with values of different domains, use domain Library.

(1) -> lb:Library := library("foo")

   (1)  "foo"
                                                         Type: Library
(2) -> x:=1 ; z := z+3

   (2)  z + 3
                                              Type: Polynomial Integer
(3) -> lb.'number:=x

   (3)  1
                                                 Type: PositiveInteger
(4) -> lb.'poly:=z

   (4)  z + 3
                                              Type: Polynomial Integer
(5) -> keys lb

   (5)  ["poly","number"]
                                                     Type: List String
(6) -> lb.'number

   (6)  1
                                                 Type: PositiveInteger
(7) -> lb.'poly

   (7)  z + 3
                                              Type: Polynomial Integer


>
> Is there a time function in axiom?

There should be a CPU timer available from domain Timer

(1) -> )sh Timer
 Timer  is a domain constructor
 Abbreviation for Timer is TIMER
 This constructor is exposed in this frame.
 Issue )edit axtimer.as to see algebra source code for TIMER

---------------------------- Operations ----------------------------
 ?=? : (%,%) -> Boolean             coerce : % -> OutputForm
 read : % -> Integer                reset! : % -> %
 start! : % -> Integer              stop! : % -> Integer
 timer : () -> %                    ?~=? : (%,%) -> Boolean
 HMS : Integer -> Record(hours: Integer,mins: Integer,seconds:
Integer,milliseconds: Integer)



>
> Any good online tutorial except
> http://www.dcs.st-and.ac.uk/~mnd/documentation/axiom_tutorial/

Doesn't the free Axiom version you are using come with hypertext help?

regards
Themos Tsikas






reply via email to

[Prev in Thread] Current Thread [Next in Thread]