> What are Lisp equivalents for isspace(), isalpha(), etc from ctype.h?
(defun isspace (input)
(eql #\Space input))
(defun isalpha (input)
(alpha-char-p input))
(defun etc ()
(print "error: undefined function, see hyperspec for more
information"))
Eric Lavigne wrote:
>>What are Lisp equivalents for isspace(), isalpha(), etc from ctype.h?
>
>
> (defun isspace (input)
> (eql #\Space input))
>
> (defun isalpha (input)
> (alpha-char-p input))
>
> (defun etc ()
> (print "error: undefined function, see hyperspec for more
> information"))
>
Thanks,
although isspace isn't quite what I am looking for. This function should
return true not only for spaces, but for newlines, tabs, and some other
characters I don't want to remember (hence don't want to write any
custom functions).
vch <····@not.real> writes:
> Eric Lavigne wrote:
> >>What are Lisp equivalents for isspace(), isalpha(), etc from ctype.h?
> > (defun isspace (input)
> > (eql #\Space input))
> > (defun isalpha (input)
> > (alpha-char-p input))
> > (defun etc ()
> > (print "error: undefined function, see hyperspec for more
> > information"))
> >
>
> Thanks,
> although isspace isn't quite what I am looking for. This function
You should run the etc function above...
In particular, you should look up graphic characters and graphic-char-p
/Jon
--
'j' - a n t h o n y at romeo/charley/november com
"vch" <····@not.real> wrote in message ··················@gavrilo.mtu.ru...
> although isspace isn't quite what I am looking for. This function should
> return true not only for spaces, but for newlines, tabs, and some other
> characters I don't want to remember (hence don't want to write any custom
> functions).
Look at the Hyperspec Characters section in particular:
13.2 The Characters Dictionary
(google cl hyperspec if you don't know what/where this is)
--
Coby Beck
(remove #\Space "coby 101 @ bigpond . com")
vch wrote:
> What are Lisp equivalents for isspace(), isalpha(), etc from ctype.h?
The Common Lisp HyperSpec (CLHS) is your friend:
http://www.lispworks.com/documentation/HyperSpec/Body/13_.htm
You will find the character functions here:
http://www.lispworks.com/documentation/HyperSpec/Body/c_charac.htm
There is no isspace() function per se. But it's simple to write:
(defun space-char-p (ch)
(find ch '(#\Space #\Page #\Newline #\Return #\Tab #\Vt)))
Caution: The names above besides #\Space and #\Newline may not be portable.
David Sletten