Re: Re: [Maxima] Message: 10: on string functions



hi Richard

I write this program according for your advise.
It's well doing but no gard.

(DEFUN $STR22LIS (X)
  
  (let ((list1 nil)
	(num (length (string X))))
    (do ((counter 2 (+ 1 counter))) ((> counter num) (cons '(mlist) (reverse list1)))
	(setq list1 
	      (if (equal 'T  (getchar X counter))(cons  "T" list1)
		(cons (getchar X counter) list1))))))
 
please save this in a file as Huen.lisp

 (C2) dnastring:"CGATATATGAGAGAT";  
 (C3) load("Huen.lisp");
 (C4) str22lis(dnastring);
 (D4)[C, G, A, T, A, T, A, T, G, A, G, A, G, A, T]
that's OK


Bytheway
I found memory leak!??at using?gensym().maybe this  caused
recent  question about ability with maxima.

thanks 
Gosei Furuya (go_furuya@infoseek.jp)
> 
> 
> -----$B85$N%a%C%;!<%8(B-----
> $B:9=P?M(B: "RichardFateman" 
> $B<u<h?M(B: "Webbooks" ,maxima@www.ma.utexas.edu
> $BF|IU(B: 01/12/31 02:15
> $B7oL>(B: Re: [Maxima] 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
> >
> 
> 
> _______________________________________________
> Maxima mailing list
> Maxima@www.math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
> 
> 



$B(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(B
$B%U%!%$%J%k%U%!%s%?%8!<%m%4IU$-%V%i%&%6$O$$$+$,!)(Bby infoseek
http://toolbar.infoseek.co.jp/?svx=971148