About types of variables



Hello, ?????,

Sorry, this is confusing -- Maxima prints "C" (a string) and C (a symbol)
the same way.
You can see they're different like this: stringp("x") => true; stringp('x)
=> false; symbolp("x") => false; symbolp('x) => true.

To convert a string to a symbol, you can use parse_string("x")=>x; be
careful, this actually parses, so parse_string("1+1") is not a symbol, but 2
(after simplification). (I can't remember what the equivalent of Lisp's
'intern' function is in Maxima, sorry....)

To convert a symbol to a string, you can use string('x)=>"x".

           -s

PS In dynamic languages like Maxima, normally variables don't have types
(though Maxima does allow you to declare types for compilation); their
values do.


2009/12/3 ???????????? ?????? <kotzeve at hotmail.com>:
> Sorry again but i am confused.Is there any function giving the type of a
> variable???
>
> I have s:"GAN";
>          x:charlist(s);
>          C:matrix([A,B,C,F],[1,2,3,4]);
>
> And i want to compare s(1) with C[1][1]..What i have to do??After trying a
> lot of things i understood that they are different types and i can't
compare
> them.I find one lazy solution by putting the word gun like this ->
x:[G,U,N]
> but it isn't useful...My problem is that i have made a matrix
>
> A:matrix([A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,_],
> [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,0]);
>
> and i want  to make a function like cint.I want to take a string and
compare
> it with A[1][i] and if are equal i want to put the number from A[2][i] in
an
> other new matrix.
>
> I made this by using the ascii code(by abstracting 65) but i want to make
it
> with a mat! rix in which i choose the numbers for the letters...
>
> Thanks for your time...I think that is sth easy but now i am confused and
i
> need some help...Thanks again!
>
> ________________________________
> Windows Live Hotmail: Your friends can get your Facebook updates, right
from
> HotmailR.
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>