Hi Alex,

Thanks for the picolisp pointers :-)  The sub? shrinks down one of the awkward 
bits there. Unfortunately, I didn't see sub? in miniPicoLisp.  The replace 
seems like a better idea than using the surgical patch there - probably not a 
good idea to modify a list passed in as an argument like I am doing with patch. 

Cheers,

Doug







--- On Sun, 7/24/11, Alexander Burger <a...@software-lab.de> wrote:

> From: Alexander Burger <a...@software-lab.de>
> Subject: Re: pilog dcg with args
> To: picolisp@software-lab.de
> Date: Sunday, July 24, 2011, 2:36 AM
> Hi Doug,
> 
> > http://victoriafamilyrobotics.net/vfr1/media/read_line.l
> 
> Please allow me to post some minor hints:
> 
> 
> When a single character is checked for a number of values
> like in
> 
>    (or (= X ",") (= X ".") (= X "?"))
> 
> then I would write instead:
> 
>    (sub? X ",.?")
> 
> 
> For the modification of a list
> 
>    (patch L "," '(" " ","))
>    (patch L "." '(" " "."))
>    (patch L "?" '(" " "?"))
> 
> I would use
> 
>    (replace L  "," '(" " ",")  "."
> '(" " ".")  "?" '(" " "?"))
> 
> Note, however, that 'replace' is non-destructive, so you
> need to use the
> returned value in the following expression (or 'setq' it to
> 'L').
> 
> Cheers,
> - Alex
> -- 
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to