Hi Doug,

> Unfortunately, I didn't see sub? in miniPicoLisp.

Oops, you are right! It is not implemented.

The reason is that 'sub?' is nasty in miniPicoLisp, due to the extremely
packed name representation of that implementation. It would require an
"ugly" solution, e.g. unpacking both names into C buffers and use
strstr() on them.

A workaround would be

   (de sub? (Pat Str)
      (and
         (match (cons '@ (conc (chop Pat) '@)) (chop Str))
         Str ) )

or

   (de sub? (Pat Str)
      (setq Pat (chop Pat))
      (and
         (seek
            '((L) (head Pat L))
            (chop Str) )
         Str ) )

(is there a better (shorter, more elegant) way?)


btw, don't you have an option to use "full" PicoLisp?

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

Reply via email to