Hi Jon,

> Is it possible to write a 'match' expression that will recognize
> (Java) strings like these two?
> @foo("bar")
> whitespace@someother("text")

Usually 'match' is not the optimal way to operate on strings. What is
the situation where you need this?

If you parse this from a file or stream, it is usually easier and more
efficient to use 'from', 'till' and/or 'echo', because it works directly
on the input data without building s-expressions first.

> I don’t know how to escape the @ so that it will not be handled as a
> wildcard symbol.

'match' doesn't support an escape mechanism. You can check for the "@"

   (let Str "@foo(\"bar\")"
      (use (@A @X @Z)
            (match '(@A "(" @X ")" @Z) (chop Str))
            (member "@" @A)
            ... do something ...

> The "whitespace" in the second line doesn’t necessarily have to be
> whitespace. The important thing is that the @ isn’t always in pos. 1.

So this can be handled with the 'member' call above.

Operating on the characters is also possible in many ways, e.g. with

   (let L (split (chop "whitespace@someother(\"text\")") "@" "(" ")")
      ... operate on the fragments with list functions ...
      ("w" "h" "i" "t" "e" "s" "p" "a" "c" "e")         
      ("s" "o" "m" "e" "o" "t" "h" "e" "r")
      ("\"" "t" "e" "x" "t" "\"")

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

Reply via email to