My vote is to waffle: mix the functional programming approach and your last option (i.e., using the '/' form).
When you're using pattern matching in rules, the last option is indeed elegant.
On the other hand, since you're integrating regular expressions into the language, it would be helpful to incorporate a set of functions that work like string matching functions (e.g., matching, extraction, substitution, and splitting). Will you incorporate a "match" type akin to the other Jess types?
Something to consider with your last option, however, is the potential inelegance that arises when matching slashes. (Note: This led to the Perl approach of using essentially arbitrary first and last characters as bounding characters for matches and substitutions (e.g., 'name =~ {/directory/file}'). My vote is to leave well enough alone and stay with the original AWK convention of forward slashes only.)
Regards,
Win
[EMAIL PROTECTED] wrote:
Hi Folks,
Charlemagne will have regular expression support. Question: what should the Jess syntax look like when you use regexes for pattern-matching? Of course, there could be a function-based approach, sorta like Python:
(animal (name ?n&:(match ?n "[a-z]*")))
Personally I think a special operator would be nice. Perl and Ruby use " =~ ", so that would look like
(animal (name =~ "[a-z]*"))
Unfortunately, Jess uses ~ to mean negation, so it's possible this
would be confusing. Another possibility would be to use "/" as
delimiters like Perl and Ruby, but no operator.
(animal (name /[a-z]*/))
This last one is kind of nice, I think.
Opinions? Other ideas?
---------------------------------------------------------
Ernest Friedman-Hill Science and Engineering PSEs Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
PO Box 969, MS 9012 [EMAIL PROTECTED]
Livermore, CA 94550 http://herzberg.ca.sandia.gov
-------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] --------------------------------------------------------------------
-------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] --------------------------------------------------------------------
