People,
may I ask more questions about parse-interpret-unparse ?
There is a book, and somewhat a helpful browser, still it occurs
difficult for me to find some things.
Waldek Hebisch wrote about parsing and interpreter:
> parse from InputForm gives parsed representation of string,
> as InputForm,
> interpret evaluates InputForm giving you result of type Any.
and gives the example
> (2) -> fp := factor(x^2-1)
>
> (2) (x - 1)(x + 1)
> Type: Factored(Polynomial(Integer))
> (3) -> fpi := fp::InputForm
>
> (3)
> (* (primeFactor (:: (+ x - 1) (Polynomial (Integer))) 1)
> (primeFactor (:: (+ x 1) (Polynomial (Integer))) 1))
> Type: InputForm
> (4) -> unparse(fpi)$InputForm
>
> (4)
> "primeFactor((x+-1)::Polynomial(Integer),1)*primeFactor(
> (x+1)::Polynomial(Integer),1)"
> Type: String
About `parse', Axiom says that there is not such an exposed operation.
Also I find the category
InputFormFunctions1
which exposes the operations interpret, coerceToType ...
But how to obtain the input form from a string ?
For example, taking "2+3",
(1) some unknown to me operation needs to produce iF : InputForm.
(2) Then, n := (interpret iF) :: Integer
produces 5. -- ?
(3) Then, unparse(n)$InputForm
produces "5". -- ?
Can you, please, a) tell me how (1) is done,
b) correct (2) and (3) if needed
?
Thanks,
------
Sergei
[email protected]
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/fricas-devel?hl=en.