Hi,
How about this:
(de singleLetter? (item)   (if (and (=1 (length item)) (or (low? item) (upp? 
item))) 1 NIL))
This returns 1 if true then NIL for false.


But if you just need NIL for false and then the letter itself for true, then 
can be shorten into this:
(de singleLetter? (item)   (and (=1 (length item)) (or (low? item) (upp? 
item))))


BR,geo



 

    On Saturday, June 17, 2017 2:52 PM, Alexander Burger <a...@software-lab.de> 
wrote:
 

 On Sat, Jun 17, 2017 at 07:35:44AM +0200, Alexander Burger wrote:
> On Fri, Jun 16, 2017 at 06:31:06PM -0800, Christopher Howard wrote:
> > Hi list. In picolisp, what would be the simplest way to check if a
> > string (trans sym) is one character long and that the character is one
> > of the letters a-z or A-Z?
> 
> I would do:
> 
>    (member C '`(mapcar char (conc (range 65 90) (range 97 122))))

Sorry, no!

It is shorter, faster and more readable to do:

  (or (>= "Z" C "A") (>= "z" C "a"))

♪♫ Alex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


   

Reply via email to