Regular List Expressions?

Regular List Expressions?

Post by Jeff M » Mon, 20 Feb 2006 10:23:49


Is there a standard library or function out there that follows the same
general regular expression rules, but against lists instead of strings?
Or, put another way, I'm hoping to be able to take several different
lists, and match data to them, from most to least specific and perform
actions based on what is inside the list. For example, if I wanted to
match the arguments to the factorial function, I might write something
like this:

(if (match '(0) args)
(progn ...)
(if (match '(#'integerp) args)
(progn ...)
(error "Doesn't match any known pattern.")))

I'm just hoping there is already something out there that does
something similar so I don't have to roll my own.

Thanks!

Jeff M.
 
 
 

Regular List Expressions?

Post by Pascal Bou » Mon, 20 Feb 2006 10:36:07

Jeff M." < XXXX@XXXXX.COM > writes:



http://www.justfuckinggoogleit.com/search?q=common-lisp+package+match

Try it!



Location: http://www.google.com/search?as_q=common%2dlisp%20package%20match%0a&num=50&hl=en&ie=ISO8869-1&btnG=Google+Search&as_epq=&as_oq=&as_eq=&lr=&as_ft=i&as_filetype=&as_qdr=all&as_nlo=&as_nhi=&as_occt=any&as_dt=i&as_sitesearch=&safe=images
Sign in
Torino 2006 Web Images Groups News Froogle Local more ?

[common-lisp package match ] Search Advanced Search
Preferences

Web Results 1 - 50 of about 124,000 for common-lisp match package . (0.19 seconds)

Tip: Save time by hitting the return key instead of clicking on "search"

UB CSE202 CHAP 29
Put a (:use common-lisp match) subform in the defpackage form, so that you can
use exported symbols from the match package without qualification in the ...
www.cse.buffalo.edu/~shapiro/ Courses/CSE202/Notes/chapter29.html - 15k -
Cached - Similar pages

UB CSE202 CHAP 12
You have mainly been using the Inferior Common Lisp mode to interact with
the ... (defpackage match) (in-package match) ----------------------- cut
here ...
www.cse.buffalo.edu/~shapiro/ Courses/CSE202/Notes/chapter12.html - 13k -
Cached - Similar pages

Running Allegro Common Lisp in XEmacs at CSU
... fi:common-lisp-mode-map (if (string-match "XEmacs" (emacs-version)) ...
The way you restrict attention to those things in the user package is with the
...
www.cs.colostate.edu/~howe/handouts/lisp-and-emacs.html - 22k -
Cached - Similar pages

ANSI and GNU Common Lisp Document - Symbols in the COMMON-LISP Package
Symbols in the COMMON-LISP Package. The figures on the next twelve pages
contain a complete enumeration of the 978 external symbols in the COMMON-LISP
...
www.cs.queensu.ca/software_docs/ gnudev/gcl-ansi/gcl_76.html - 32k -
Cached - Similar pages

ANSI and GNU Common Lisp Document - Specifiers for keyword parameters
... then the keyword name used to match arguments to parameters is
keyword-name, ... (Of course, if it is not a symbol in the KEYWORD package
, it does not ...
www.cs.queensu.ca/software_docs/ gnudev/gcl-ansi/gcl_217.html - 6k -
Cached - Similar pages

Common Lisp Extensions - Predicates
The CL package defines a version of the Common Lisp typep predicate. ... The
type symbols character and string-char match integers in the range from 0 to
...
 
 
 

Regular List Expressions?

Post by Jeff M » Mon, 20 Feb 2006 10:43:54

Well, that sure didn't help.

Yes, I used Google for quite some time before posting here, thanks. The
closest I could get was LispWorks' parsergen package, which seemed like
a bit overkill, but maybe that's the best I can do.

Did you even look at the results you got before posting them? Of
course, if somewhere on page 13 of the search results was a buried
answer to my question, I appologise, I missed it.

Jeff M.
 
 
 

Regular List Expressions?

Post by pkhuon » Mon, 20 Feb 2006 12:33:05


Last of the pasted links. Googling for the updated location yields:

http://www.yqcomputer.com/

Paul Khuong
 
 
 

Regular List Expressions?

Post by Jeff M » Mon, 20 Feb 2006 12:42:11

Danke. :-)

Jeff M.
 
 
 

Regular List Expressions?

Post by Pascal Bou » Mon, 20 Feb 2006 14:16:06

"Jeff M." < XXXX@XXXXX.COM > writes:


For example this one on the first result page is quite usable.



Oops, I see now that this is exactly the only Paul indicated.

But the important point, is that to make an effective use of google
you need to know the precise keywords. So once you've fetched the
most promizing hit on the first page, you usually gather a few more
keywords:

;;; This matcher defines simple regexp-type matching of a pattern
;;; against a list expression. (Note: This is not a full regular expression
;;; matcher.)



And then you get more and better results:

Location: http://www.yqcomputer.com/ %2dlisp%20pattern%20matcher%0a&num=50&hl=en&ie=ISO8869-1&btnG=Google+Search&as_epq=&as_oq=&as_eq=&lr=&as_ft=i&as_filetype=&as_qdr=all&as_nlo=&as_nhi=&as_occt=any&as_dt=i&as_sitesearch=&safe=images
Sign in
Torino 2006 Web Images Groups News Froogle Local more ?

[common-lisp pattern matcher ] Search Advanced Search
Preferences

Web Results 1 - 50 of about 132,000 for common-lisp pattern matcher . (0.19
seconds)

--
__Pascal Bourguignon__ http://www.yqcomputer.com/

"Our users will know fear and cower before our software! Ship it!
Ship it and let them flee like the dogs they are!"
 
 
 

Regular List Expressions?

Post by Edi Weit » Mon, 20 Feb 2006 18:56:05


I addition to Mark Kantrowitz' code which was already mentioned
there's also a port of CL-PPCRE to arbitrary sequences:

< http://www.yqcomputer.com/ ;

Probably not in sync with the latest CL-PPCRE version, but maybe it's
helpful.

Cheers,
Edi.

--

European Common Lisp Meeting 2006: < http://www.yqcomputer.com/ ;

Real email: (replace (subseq " XXXX@XXXXX.COM " 5) "edi")
 
 
 

Regular List Expressions?

Post by Matthew D » Tue, 21 Feb 2006 01:15:57


What is the "alphabet" of the language that a regular expression generates
associated with (possibly) nested lisp lists?

Matt

--
"You do not really understand something unless you can
explain it to your grandmother." ?Albert Einstein.