From: vch
Subject: character classification functions
Date: 
Message-ID: <d9kaks$1o6s$1@gavrilo.mtu.ru>
What are Lisp equivalents for isspace(), isalpha(), etc from ctype.h?

From: Eric Lavigne
Subject: Re: character classification functions
Date: 
Message-ID: <1119731187.248480.92650@g14g2000cwa.googlegroups.com>
> 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"))
From: vch
Subject: Re: character classification functions
Date: 
Message-ID: <d9kfdn$1qik$1@gavrilo.mtu.ru>
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).
From: jayessay
Subject: Re: character classification functions
Date: 
Message-ID: <m34qbmw0l5.fsf@rigel.goldenthreadtech.com>
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
From: Coby Beck
Subject: Re: character classification functions
Date: 
Message-ID: <ElCve.77293$HI.32156@edtnps84>
"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")
From: David Sletten
Subject: Re: character classification functions
Date: 
Message-ID: <cvxve.23667$h86.17426@tornado.socal.rr.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