Hi Alex,

On 12. Sep, 2014, at 16:06, Alexander Burger <a...@software-lab.de> wrote:

> It is not a good idea to build a list only to count its length. Better
> count in a loop directly, e.g.:
> 
>   (de sindex (Frag Src)
>      (for ((I . L) (chop Src) L (cdr L))
>         (T (pre? Frag L) I) ) )

For this 'sindex' I think it would be good to first test if Frag is NIL, since 
with your version above (sindex NIL "foo") would give 1. Therefor I would do 
this:

(de sindex (Frag Src)
  (if Frag
    (for ((I . L) (chop Src) L (cdr L))
      (T (pre? Frag L) I) ) ) )

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

Reply via email to