axiom-developer
[Top][All Lists]
Advanced

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

[Axiom-developer] accessing the input function form in Axiom


From: daly
Subject: [Axiom-developer] accessing the input function form in Axiom
Date: Thu, 23 Oct 2014 03:49:10 -0500

Ralf,

Axiom does keep the information you're looking for.

(1) -> f(x) == 3*x^2+5
                                                Type: Void
(2) -> )history )show 1
    [1] f(x) == 3*x^2+5

If you want a Spad "cover" you could create the package

)abbrev package HISTORY History
....

which exported a function to access the command line history
(using lisp function calls unfortunately but it would maintain
the illusion that Spad "isn't really lisp" outside the package).

You could keep it "at the Spad level" by using the file system.

)history )save foo
  Edit foo.input to see the saved input lines
  The saved history file is foo.axh

The "foo.input" file looks like

------------------------------------------------------------------------
f(x) == 3*x^2+5
------------------------------------------------------------------------

which you could search to find "f(x) == 3*x^2+5".

For more detail about the function you could access foo.axh/index.kaf
which is a "keyed access file". You could extend GETDATABASE
which knows how to manipulate .kaf files. The format is (was)
explained in the source code. Anyway, the foo.axh/index.kaf file:

------------------------------------------------------------------------
335                 ("f(x) == 3*x^2+5" (% (|value| (|Void|) . "()"))
                     (|f|
                      (|value| (|FunctionCalled| |f|) SPADMAP
                       (|#1| + (* 3 (^ |#1| 2)) 5))
                      (|recursive|) (|alias| |x|) (|isInterpreterFunction| . T)
                      (|isInterpreterRule|)))
(("1" 0 20))
------------------------------------------------------------------------

where 335 is a byte offset to the dictionary entry list (("1" 0 20))
which means that user input (1) is 20 bytes into the file

so you seek 20 bytes from the start of the file for the object
which is a list object whose CAR is the string input you seek.

(Sorry for the lisp)

Tim




reply via email to

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