Michael Somos on Sun, 15 Dec 2002 17:18:22 -0500


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Vec vs Vecsmall


pari-dev,

     I just looked at what Mathematica does in regards to
characters and strings. It deals with Unicode characters
and also has the following functions, of which I have made
some PARI-GP rough equivalents.

? \rchr.gp
? Characters(s)=if(type(s)==type(""),Vec(s))
? ToCharacterCode(s)=if(type(s)==type(""),Vecsmall(s))
? {FromCharacterCode(x)=local(s);if(type(x)==type(0),chr[x],s="";
  for(n=1,length(x),s=concat(s,FromCharacterCode(x[n])));s)}
? FromCharacterCode(65)
%97 = "A"
? Characters("abc")
%98 = ["a", "b", "c"]
? ToCharacterCode("abc")
%99 = Vecsmall([97, 98, 99])
? FromCharacterCode(%)
%100 = "abc"

We could just decide to make Vec("") and Vecsmall("") errors
and provide the functionality I indicate some other way. Shalom,
Michael