Message: 10: on string functions



Probably you should be writing in lisp.

In lisp, the string x="CGATATATA..."

is simply an array of characters, and can be addressed
as (aref x 0), (aref x 1), etc.

There are functions for concatenation, substitution, etc.


The macsyma program you write produces a lisp list that
looks like
  ((mlist simp) $C $G $A ....)

If you really want to use a lisp list, you can convert
a string to a list, perhaps using coerce.  or else
approximately the way you have written it in macsyma.

What is important to figure out is:  what parts of
the programming are
(a) hard to write
(b) need to run fast.

Usually these are different parts.


Although the programs you mention could be added to maxima,
I think it is worth pointing out that much of the later program
development was done on the basis of what users expressed
a need for, and what developers thought would be neat to
include.

RJF


Webbooks wrote:

> Hello:
> 
> I found  that Maxima is rather weak on string processing.  
> I regularly downloaded dna strings from genome databases
> which are presented in string formats.   I have no 
> problems in Macsyma converting strings to lists and 
> vice versa but I have a problem with Maxima because
> the getchar function and string_length function are  not defined.  
> Here is what I did in Macsyma:
> 
> dnastring:"CGATATATATGAGAGAT";
> CGATATATATGAGAGAT
> 
> dnalist:makelist(getchar(dnastring,k),k,1,string_length(dnastring));
> [C, G, A, T, A, T, A, T, A, T, G, A, G, A, G, A, T]
> 
> Is there anyone who could suggest how I could do the conversion
> from a string to a list.  Incidentally concat function is available in
> Maxima which makes it possible to convert a list to a string but
> why is this provided when other obvious string functions are not
> provided?
> 
> HuenYK
> www.cahresearch.com   the SA people
> =============================end msg==========
> 
> _______________________________________________
> Maxima mailing list
> Maxima@www.math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>