find.hlp 1.0 KB

12345678910111213141516171819202122232425
  1. FIND.RED - Recognition and search OBLIST functions
  2. -------------------------------------------------
  3. This is a loadable option [Load Find; in RLISP, (Load Find) in LISP].
  4. These functions take a string or id, and map the Symbol Table to
  5. collect a list of ids with Prefix or Suffix as given:
  6. FindPrefix(Key:{Id, String}):id-list Scan Symbol Table for prefix
  7. FindSuffix(Key:{Id, String}):id-list Scan Symbol Table for suffix
  8. Find(Pattern:{Id,String}):id-list Scan Symbol Table for matching string
  9. Thus X:=FindPrefix '!*; Finds all ids starting with *
  10. The 'GSORT' package is used to sort the list.
  11. The Pattern is a string, with special characters, prefixed by %, like the
  12. format string in PrintF; StringMatch(pattern,subject) is called:
  13. %% Match a % in subject string
  14. %? Match any one character
  15. %* Match any series of characters (0..n)
  16. Thus Find "*%*"; is equivalent to FindPrefix "*";
  17. Find "%**"; is equivalent to FindSuffix "*";
  18. Find "A%*B"; matches any string starting with A and ending with B.