ASCII codes in Maxima



--Alt-Boundary-26107.19882749
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7BIT
Content-description: Mail message body

Am 26 Nov 2005 um 23:40 hat Alasdair McAndrew geschrieben:

> With clisp I can use ?character:
> 
> (%i1) ?character(69);
> (%o2)                      E
> 
> but I don't know how to use the clisp functions "char-code" or
> "char-int", which convert a character to its ascii code, without the
> hyphen being interpreted by Maxima as a subtraction.
> 
> -Alasdair
> 

Hi Alasdair,

the following shows the interaction Lisp <-> Maxima and how you can define a Maxima 
function using a Lisp function you know.

Tell me, if these new definitions work with clisp.

You have to load stringproc first, because I use the conversion functions m-char and l-
char.

(%i1) load("stringproc1");
(%o1) 			   D:/home/maxima/stringproc1.lisp
(%i2) :lisp(defun $cint (mch) (char-code (l-char mch)))
$CINT
(%i2) cint("a");
(%o2) 				      97
(%i3) :lisp(defun $ascii (n) (m-char (character n)))
$ASCII
(%i3) ascii(123);
(%o3) 				       {


cheers
Volker

--Alt-Boundary-26107.19882749
Content-type: text/html; charset=US-ASCII
Content-transfer-encoding: 7BIT
Content-description: Mail message body






Am 26 Nov 2005 um 23:40 hat Alasdair McAndrew geschrieben:

> With clisp I can use ?character:
>
> (%i1) ?character(69);
> (%o2)                      E
>
> but I don't know how to use the clisp functions "char-code" or
> "char-int", which convert a character to its ascii code, without the
> hyphen being interpreted by Maxima as a subtraction.
>
> -Alasdair
>

Hi Alasdair,

the following shows the interaction Lisp <-> Maxima and how you can define a Maxima function using a Lisp function you know.

Tell me, if these new definitions work with clisp.

You have to load stringproc first, because I use the conversion functions m-char and l- char.

(%i1) load("stringproc1");
(%o1)                              D:/home/maxima/stringproc1.lisp
(%i2) :lisp(defun $cint (mch) (char-code (l-char mch)))
$CINT
(%i2) cint("a");
(%o2)                                             97
(%i3) :lisp(defun $ascii (n) (m-char (character n)))
$ASCII
(%i3) ascii(123);
(%o3)                                              {


cheers
Volker
--Alt-Boundary-26107.19882749--