Thanks.
> > 1. Where can be found simple examples of Spad programs?
> > [..]
> Chapters 11, 12 and 13 of Axiom book (visible in HyperDoc).
> [..]
In particular, I searched for an example of a function with value in a
direct product of types ( T1 x T2, T1 x T2 x T3 of the set theory ).
I hoped to find such in the functions for List.
Now, you point to Record and Product.
Also I guessed now to see `divide' of EuclideanDomain. All right.
> > 3. List Character vs String
> > Haskell puts type String = [Char]
> > [..]
> >
> > I hope to program strings in Spad by using the conversion
> > String <--> List Character.
> String is an exaple of Collection, and you can construct collections
> from parts using 'construct' operation. Usually 'construct' is
> abbreviated to just square brackets:
>
> (11) -> construct(members("John"))$String
>
> (11) "John"
> Type: String
> (12) -> [members("John")]$String
>
> (12) "John"
> Type: String
>
> Note that in Spad generic functions work on Collections, so you
> should be able to do most of processing without convertiong to
> lists.
>
> I am not sure if converting string to lists is good idea. It
> may help if you want to some hairy manipulations, but otherwise
> working on strings directly should be easier. And if you need
> to make something fast, then using array may give you significant
> speedup (for example you can index strings in O(1) time, but
> indexing lists is O(n)).
>
Thank you very much.
I need to program a certain specialized parser (: String -> ...),
as
the category + its instances for the constructors of
Integer, Vector, Fraction, Poly, and such.
So far, I doubt, probably, it is needed to first break to lexemes:
"(2*powerProduct([4,1,2])+1*Product([])" -->
[ "(", "2", "*", "powerProduct", "(", "[", "4", ",", ... ],
and then, to do the real parsing for lexemes. This will mostly need to
operate with generic lists.
By the way, what are lexemes in the Spad language?
Has the library a function that breaks a string to the Spad lexemes?
In DoCon, I use the Haskell lexemes for this and the corresponding library
function for breaking to lexemes (and this also defines what is a lexeme).
Regards,
------
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.