[REBOL] Newbie question #2 - Pattern making and using? Re:(11)
Hi Gabriele, thanks for posting this to the mailing list. In general I would appreciate it if questions that are probably of general interest be posted to the mailing list, since we can all learn from the questions as well as the answers. At 12:00 PM 4/2/00 +0200, you wrote: >Hello jb! > >On 01-Apr-00, you wrote: > >[Forwarding to the list] > > j> Gabrielle, > >Just one "l"... :-) > > j> For the past two months when I have the time to review the > j> rebol posts, I've appreciated reading your succint, thoughful > j> and clear examples. Thankyou. Your method outlined below is a > j> fine example of this. You are both an excellent teacher and > j> certainly you must be a world class programmer ! :-> > >Thank you. You're surely exaggerating --- I'm just a student! :) > > j> Perhaps you will be so kind as to provide urls for the best > j> examples of pattern matching techniques for REBOL? For > >I think you can find a lot of examples on rebol.org. I've written >a site-saver too (downloads an HTML document plus all of the links >etc.); it still needs some work, so I didn't publish it yet, as >you can get a couple of other script doing the same job on >rebol.org, but if you're interested... > > j> example, let's assume a useful utility will crawl through a > j> web site and gather only the links on the site saving them to > j> a file, how does a good rebol programmer think about and then > j> execute the following: > > j> find all instances of the following pattern > j> http://yy.yyy/ ( ie any and all urls in a web page.) > j> and return and then store only the http://y.yyy portion to > j> a file appending a newline to each ? > >If you assume that the initial "http://" is always present, as >well as the "/" after the domain name, the task is really easy: > > file-port: open/lines %destination-file.txt > parse text-containing-links [ > any [ > to "http://" copy url ["http://" to "/"] > (insert tail file-port url) > ] > ] > close file-port > >If you just want to assume that the URLs begin with "http://": > > url-rule: ["http://" some domain-chars] > domain-chars: complement charset [#"^(00)" - #" " #"/"] > parse text-containing-links [ > any [ > to "http://" copy url url-rule > (insert tail file-port url) > ] > ] > > j> Now with perl the matching expression is relatively short and > j> the assignment of the value is rather straight forward as well > j> as the printing to a append the file. > > j> Feel free to forward this letter to the list with your > j> response. I'd love to see how others will answer it. > > j> TIA, > j> JB > > j> PS > j> *I'm replying off list because my temporary isp doesn't > j> forward my mail when I use my subscribed email account. > >Regards, >Gabriele. >-- >o) .-^-. (--o >| Gabriele Santilli / /_/_\_\ \ Amiga Group Italia --- L'Aquila | >| GIESSE on IRC \ \-\_/-/ / http://www.amyresource.it/AGI/ | >o) `-v-' (--o > > > > ;- Elan >> [: - )]
[REBOL] FW: [REBOL] Newbie question #2 - Pattern making and using? Re:(9)
>cat: [ [thru "cat " | thru " cat" | thru "kitty " | thru " kitty"] to end ] >sentence: "I have a dog and a cat" >print (parse sentence cat) and (parse sentence dog) >> TRUE I've not been following this thread close enough to know whats really going on, but to me it looks like your reinventing the parser from an Adventure Game. Why not port the needed section of the game Nethack, or other text based adventure game, to Rebol?
[REBOL] Newbie question #2 - Pattern making and using? Re:(9)
Hi TB, have a look at this one ... REBOL [] test-cases: [ "I have a fluffy kitty and a black lab" TRUE "I have a fluffy kitty and a orange tabby" FALSE "Where is my mangy mutt?" False "Where can I buy a book on programming REBOL?" False ] cat: [thru "orange" "tabby" | thru "fluffy" "kitty" ] dog: [thru "mangy" "mutt" | thru "black" "lab" ] rule: [ cat dog | dog cat ] ; to be sure to catch them either way foreach [str val] test-cases [ prin [ str "(" val ") -> "] print parse str rule ] comment { My first idea for 'rule was rule: [ some [ cat (cat-found: true) | dog (dog-found: true) ] Problems: - without them xxx-found: true you couldn't be sure, to not catch cat twice (sentence 2). - a sentence with 'dog and 'cat in this order "I have a black lab and a fluffy kitty." would first find the kitty, and thus read over your dog. I _think_ there was a solution to this ... Note: Parse capabilities have greatly improved in /View, and will be part of the next /Core release, too. } halt I hope this helps Ingo -- _ ._ ingo@)|_ /| _| _ ingo@| |(_|o(_)| (_| http://www.2b1.de/Rebol/ ._| ._|
[REBOL] Newbie question #2 - Pattern making and using? Re:(9)
[EMAIL PROTECTED] wrote: > "if found cat AND dog then x: true" x: parse sentence [start: to "cat" :start to "dog" to end] The OR is more readable: x: parse sentence [[to "cat" | to "dog"] to end] HTH, Gabriele.
[REBOL] Newbie question #2 - Pattern making and using? Re:(9)
- Puvodní zpráva - Od: <[EMAIL PROTECTED]> Komu: <[EMAIL PROTECTED]> Odesláno: 28. brezna 2000 2:56 Predmet: [REBOL] Newbie question #2 - Pattern making and using? Re:(8) > Look, this works, but... > > REBOL[] > > catx: false > dogx: false > > dog: [["black" "mutt"]["mangy" "dog"]] > cat: [["fat" "cat"] ["furry" "feline"]] > > foo: "My tiger has swallowed a mangy dog and a fat > cat." > > words: parse foo "." > foreach val cat [if found? find words val [catx: > true]] > foreach val dog [if found? find words val [dogx: > true]] > > if dogx = true and catx = true [print "OK"] > > unfortunately, you cant use AND on a string, so i need > to create non string values (catx and dogx)... i just > thought there must be some tighter code. Also, if i > have 100,000 catx and dogx values, do i need to give > them all a initial value of 'false' first? > TB First, I must tell you, that Rebol/View uses more advanced parse, than Rebol/Core. In Rebol/Core you can go like this: match?: func [ sentence [block!] pattern [block!] ] [ foreach val pattern [ if find sentence val [return true] ] false ] cat: [["fluffy" "kitty"]["orange" "tabby"]] dog: [["mangy" "mutt"]["black" "lab"]] dogcat: func [ foo [string!] /local words ] [ words: parse foo "." (match? words cat) and (match? words dog) ] >> dogcat "I have a fluffy kitty and a black lab" == true >> dogcat "I have a fluffy kitty and a orange tabby" == false >> dogcat "Where is my mangy mutt?" == false >> dogcat "Where can I buy a book on programming REBOL?" == false Regards, Ladislav
[REBOL] Newbie question #2 - Pattern making and using? Re:(8)
Look, this works, but... REBOL[] catx: false dogx: false dog: [["black" "mutt"]["mangy" "dog"]] cat: [["fat" "cat"] ["furry" "feline"]] foo: "My tiger has swallowed a mangy dog and a fat cat." words: parse foo "." foreach val cat [if found? find words val [catx: true]] foreach val dog [if found? find words val [dogx: true]] if dogx = true and catx = true [print "OK"] unfortunately, you cant use AND on a string, so i need to create non string values (catx and dogx)... i just thought there must be some tighter code. Also, if i have 100,000 catx and dogx values, do i need to give them all a initial value of 'false' first? TB --- [EMAIL PROTECTED] wrote: > > > and I need an expression that will come back as > TRUE > > > for foo: "Old yeller done gone and ate my fluffy > > > kitty." or.. if found dog: "old yeller" AND if > found > > > "ate" AND if found cat: "fluffy kitty" then > > > dog-ate-cat: true > > It seems to me you're taking them all for a walk! =) > > I've just followed a course on natural language > processing, where the > professor showed us a system he had helped develop > that interpreted > sentences and converted them to propositional logic. > It took about two years > to make and was very impressive. Your questions make > it seem as if you want > the Rebol Mailing list guru's to solve all your > problems for you. > > Do you have a system you would like to implement in > Rebol, or are you > starting from scratch? > > In short: what is your purpose? > > Regards, > Rachid > > __ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://im.yahoo.com
[REBOL] FW: [REBOL] Newbie question #2 - Pattern making and using? Re:(8)
After having said that (see below) this is the closest I could get: Assuming that your sentence ONLY includes BLANK as a word separator: cat: [ [thru "cat " | thru " cat" | thru "kitty " | thru " kitty"] to end ] dog: [ [thru "dog " | thru " dog" | thru "mutt " | thru " mutt"] to end ] sentence: "I have a dog and a cat" print (parse sentence cat) and (parse sentence dog) > TRUE sentence: "I have a mutt and a kitty" print (parse sentence cat) and (parse sentence dog) > TRUE sentence: "I just have a cat" print (parse sentence cat) and (parse sentence dog) > FALSE sentence: "I have a vacation dog" print (parse sentence cat) and (parse sentence dog) > FALSE You could, of course, get alot fancier with your patterns. -Original Message- From: Jelinek, Michael Sent: Monday, March 27, 2000 4:02 PM To: '[EMAIL PROTECTED]' Subject: RE: [REBOL] Newbie question #2 - Pattern making and using? Re:(8) 'parse does just what the REBOL doc says: pattern matching. True, it doesn't do everything (nothing does), but I don't think it will do what you want. You want to split the sentence up into "words", then match those (whole) words. This is a little more than just matching patterns. To match english words, you have to first parse those words out of the sentence (you can use 'parse for this), then match against those (whole) words. 'parse doesn't match against the whole words; 'parse will match any substring of each word. So, I don't think 'parse is all you are looking for. My guess is that you will need a combination of 'parse, and a loop around a 'find. You could always write a REBOL dialect for your purpose. - Michael Jelinek
[REBOL] Newbie question #2 - Pattern making and using? Re:(9)
'parse does just what the REBOL doc says: pattern matching. True, it doesn't do everything (nothing does), but I don't think it will do what you want. You want to split the sentence up into "words", then match those (whole) words. This is a little more than just matching patterns. To match english words, you have to first parse those words out of the sentence (you can use 'parse for this), then match against those (whole) words. 'parse doesn't match against the whole words; 'parse will match any substring of each word. So, I don't think 'parse is all you are looking for. My guess is that you will need a combination of 'parse, and a loop around a 'find. You could always write a REBOL dialect for your purpose. - Michael Jelinek
[REBOL] Newbie question #2 - Pattern making and using? Re:(8)
well... i don't know about ALL my questions... (this is number 2) please feel free to ignore it... but on Rebol's own site under "features" it says, "Parser dialect provides advanced pattern matching (all the power of, but much easier to use than, traditional regular-expressions) And the question hasn't been answered fully yet, so ?. here it is again (hopefully clearer)... cat: [["fluffy" "kitty"]["orange" "tabby"]] dog: [["mangy mutt"]["black lab"]] so, im just looking for the "easier to use Parser dialect" that will answer - "if found cat AND dog then x: true" (now that is what i call simple) examples... foo: "I have a fluffy kitty and a black lab" TRUE foo: "I have a fluffy kitty and a orange tabby" FALSE foo: "Where is my mangy mutt?" False foo: "Where can I buy a book on programming REBOL?" False Not looking for a parse that will answer an exact string, but one that can use patterns. Thanks again. TB --- [EMAIL PROTECTED] wrote: > > > and I need an expression that will come back as > TRUE > > > for foo: "Old yeller done gone and ate my fluffy > > > kitty." or.. if found dog: "old yeller" AND if > found > > > "ate" AND if found cat: "fluffy kitty" then > > > dog-ate-cat: true > > It seems to me you're taking them all for a walk! =) > > I've just followed a course on natural language > processing, where the > professor showed us a system he had helped develop > that interpreted > sentences and converted them to propositional logic. > It took about two years > to make and was very impressive. Your questions make > it seem as if you want > the Rebol Mailing list guru's to solve all your > problems for you. > > Do you have a system you would like to implement in > Rebol, or are you > starting from scratch? > > In short: what is your purpose? > > Regards, > Rachid > > __ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://im.yahoo.com
[REBOL] Newbie question #2 - Pattern making and using? Re:(7)
> > and I need an expression that will come back as TRUE > > for foo: "Old yeller done gone and ate my fluffy > > kitty." or.. if found dog: "old yeller" AND if found > > "ate" AND if found cat: "fluffy kitty" then > > dog-ate-cat: true It seems to me you're taking them all for a walk! =) I've just followed a course on natural language processing, where the professor showed us a system he had helped develop that interpreted sentences and converted them to propositional logic. It took about two years to make and was very impressive. Your questions make it seem as if you want the Rebol Mailing list guru's to solve all your problems for you. Do you have a system you would like to implement in Rebol, or are you starting from scratch? In short: what is your purpose? Regards, Rachid
[REBOL] Newbie question #2 - Pattern making and using? Re:(6)
Hi, TBrownell wrote: > Very nice indeed...now just one more aspect.. > what if you want to find one match from 2 strings? > eg. > cat: [["furry "feline"]["fluffy" "kitty"]] > dog: [["old" "yeller"]["rin" "tin" "tin"]] > > and I need an expression that will come back as TRUE > for foo: "Old yeller done gone and ate my fluffy > kitty." or.. if found dog: "old yeller" AND if found > "ate" AND if found cat: "fluffy kitty" then > dog-ate-cat: true > > Thanks again. > TBrownell > > --- [EMAIL PROTECTED] wrote: > > Hi, > > > > TBrownell wrote: > > > > > That works great, but how about finding more than > > one > > > word in the string...eg. cat: ["fat cat" "furry > > > feline"] > > > Thanks in advance > > > > cat: [["fat" "cat"] ["furry" "feline"]] > > foo: "My kitty has eaten a furry feline and a fat > > cat." > > words: parse foo "." > > foreach stc cat [ > > if found? find words stc [ > > prin "found: " print stc > > ] > > ] > > Not sure, if I understand what you need... You could say something like this: foo: {Old yeller done gone and ate my fluffy kitty.} words: parse foo "." dog-ate-cat: found? all [ find words ["old" "yeller"] find words "ate" find words ["fluffy" "kitty"] ]
[REBOL] Newbie question #2 - Pattern making and using? Re:(5)
Very nice indeed...now just one more aspect.. what if you want to find one match from 2 strings? eg. cat: [["furry "feline"]["fluffy" "kitty"]] dog: [["old" "yeller"]["rin" "tin" "tin"]] and I need an expression that will come back as TRUE for foo: "Old yeller done gone and ate my fluffy kitty." or.. if found dog: "old yeller" AND if found "ate" AND if found cat: "fluffy kitty" then dog-ate-cat: true Thanks again. TBrownell --- [EMAIL PROTECTED] wrote: > Hi, > > TBrownell wrote: > > > That works great, but how about finding more than > one > > word in the string...eg. cat: ["fat cat" "furry > > feline"] > > Thanks in advance > > cat: [["fat" "cat"] ["furry" "feline"]] > foo: "My kitty has eaten a furry feline and a fat > cat." > words: parse foo "." > foreach stc cat [ > if found? find words stc [ > prin "found: " print stc > ] > ] > > Regards, > Ladislav > > __ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://im.yahoo.com
[REBOL] Newbie question #2 - Pattern making and using? Re:(5)
My hat's off to Ladislav! *Very* nice! Russell [EMAIL PROTECTED] - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, March 25, 2000 3:46 AM Subject: [REBOL] Newbie question #2 - Pattern making and using? Re:(4) > Hi, > > TBrownell wrote: > > > That works great, but how about finding more than one > > word in the string...eg. cat: ["fat cat" "furry > > feline"] > > Thanks in advance > > cat: [["fat" "cat"] ["furry" "feline"]] > foo: "My kitty has eaten a furry feline and a fat cat." > words: parse foo "." > foreach stc cat [ > if found? find words stc [ > prin "found: " print stc > ] > ] > > Regards, > Ladislav > >
[REBOL] Newbie question #2 - Pattern making and using? Re:(4)
Hi, TBrownell wrote: > That works great, but how about finding more than one > word in the string...eg. cat: ["fat cat" "furry > feline"] > Thanks in advance cat: [["fat" "cat"] ["furry" "feline"]] foo: "My kitty has eaten a furry feline and a fat cat." words: parse foo "." foreach stc cat [ if found? find words stc [ prin "found: " print stc ] ] Regards, Ladislav
[REBOL] Newbie question #2 - Pattern making and using? Re:
Of course there are a couple of different ways to do this, depending on how picky you are with matching sub-strings. Something (simple) you might be searching for is: cat-rules: [[thru "kitty" | thru "cat" | thru "feline"] to end] print parse "I have a cat and a dog" cat-rules print parse "I have a horse and a dog" cat-rules However, this will also match: print parse "I am catatonic" cat-rules To get a really good match (and not match sub-patterns of words) I think you'd have to use a loop: cat-words: ["kitty" "cat" "feline"] sentence: "I have a cat and a dog" x: foreach this-word parse sentence none [ either find cat-words this-word [break/return this-word][none] ] print x -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 23, 2000 5:58 PM To: [EMAIL PROTECTED] Subject: [REBOL] Newbie question #2 - Pattern making and using? Ok... how do i make a pattern so that one word eg cat: can mean cat feline tiger etc. The following works, but this code looks imperfect. x: none cat: "feline" cat: "kitty" fact: "I have a kitty" if found? find fact cat [x: "found it"] if found? x [print x] unset 'x How can i make the 2 values of cat: into a pattern that can be used in this script? Also, the rest of this script stinks... THERE MUST BE A BETTER WAY!!! Humbly, T Brownell __ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://im.yahoo.com
[REBOL] Newbie question #2 - Pattern making and using? Re:(5)
Is April Fool's day coming early, this year? Expecting a parser to know associations like "fat cat" is too much for me! It'd be easy to find "fat-cat". Russell [EMAIL PROTECTED] - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, March 24, 2000 4:39 PM Subject: [REBOL] Newbie question #2 - Pattern making and using? Re:(4) > TBrownell wrote: > > That works great, but how about finding more than one word in the > string...eg. cat: ["fat cat" "furry feline"] > > And what about "Rufus, he's a cool cat, man!" ? :-) > > Does it apply to a cat or a human? :-) > > Andrew Martin > ICQ: 26227169 > http://members.xoom.com/AndrewMartin/ > -><- >
[REBOL] Newbie question #2 - Pattern making and using? Re:(4)
TBrownell wrote: > That works great, but how about finding more than one word in the string...eg. cat: ["fat cat" "furry feline"] And what about "Rufus, he's a cool cat, man!" ? :-) Does it apply to a cat or a human? :-) Andrew Martin ICQ: 26227169 http://members.xoom.com/AndrewMartin/ -><-
[REBOL] Newbie question #2 - Pattern making and using? Re:(3)
That works great, but how about finding more than one word in the string...eg. cat: ["fat cat" "furry feline"] Thanks in advance TBrownell --- [EMAIL PROTECTED] wrote: > Here's an approach. > > >> cat: ["cat" "feline" "kitty" "lion"] > == ["cat" "feline" "kitty" "lion"] > >> fact: "I have a kitty" > == "I have a kitty" > >> foreach wrd parse fact none [if found? find cat > wrd [prin "found " print > wrd]] > found kitty > >> > This is a bit simplified. If > > >> fact: "My kitty cat ate a mouse." > == "My kitty cat ate a mouse." > >> foreach wrd parse fact none [if found? find cat > wrd [prin "found " print > wrd]] > found kitty > found cat > == false > >> > The == false is the result of words after the search > words. Perhaps, in > place of 'if, 'either could be used with [] for the > "else" action block. > Yeah! That works! > Also if fact: "I have a kitty." it fails because the > simple parse generates > ["I" "have" "a" "kitty."] > Parse needs to be modified to dump the period. > > > Russell [EMAIL PROTECTED] > - Original Message - > From: <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Thursday, March 23, 2000 8:46 PM > Subject: [REBOL] Newbie question #2 - Pattern making > and using? Re: > > > > Hi T Brownell > > > > you wrote: > > >x: none > > >cat: "feline" > > >cat: "kitty" > > >fact: "I have a kitty" > > >if found? find fact cat [x: "found it"] > > >if found? x [print x] > > >unset 'x > > > > A few remarks: > > > > >x: none > > this line is not necessary. But it's not a bad > idea. > > > > >cat: "feline" > > >cat: "kitty" > > > > Now cat evaluates to "kitty" only! cat no longer > evaluates to "feline"! If > > you try this code against fact: "I have a feline" > find will fail! > > > > Given: > > >cat: "feline" > > >cat: "kitty" > > >fact: "I have a kitty" > > > > you could say: > > if found? find fact cat [print x: "found it"] > > > > >How can i make the 2 values of cat: into a > pattern > > >that can be used in this script? Also, the rest > of > > >this script stinks... THERE MUST BE A BETTER > WAY!!! > > > > > > __ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://im.yahoo.com
[REBOL] Newbie question #2 - Pattern making and using? Re:(2)
Here's an approach. >> cat: ["cat" "feline" "kitty" "lion"] == ["cat" "feline" "kitty" "lion"] >> fact: "I have a kitty" == "I have a kitty" >> foreach wrd parse fact none [if found? find cat wrd [prin "found " print wrd]] found kitty >> This is a bit simplified. If >> fact: "My kitty cat ate a mouse." == "My kitty cat ate a mouse." >> foreach wrd parse fact none [if found? find cat wrd [prin "found " print wrd]] found kitty found cat == false >> The == false is the result of words after the search words. Perhaps, in place of 'if, 'either could be used with [] for the "else" action block. Yeah! That works! Also if fact: "I have a kitty." it fails because the simple parse generates ["I" "have" "a" "kitty."] Parse needs to be modified to dump the period. Russell [EMAIL PROTECTED] - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, March 23, 2000 8:46 PM Subject: [REBOL] Newbie question #2 - Pattern making and using? Re: > Hi T Brownell > > you wrote: > >x: none > >cat: "feline" > >cat: "kitty" > >fact: "I have a kitty" > >if found? find fact cat [x: "found it"] > >if found? x [print x] > >unset 'x > > A few remarks: > > >x: none > this line is not necessary. But it's not a bad idea. > > >cat: "feline" > >cat: "kitty" > > Now cat evaluates to "kitty" only! cat no longer evaluates to "feline"! If > you try this code against fact: "I have a feline" find will fail! > > Given: > >cat: "feline" > >cat: "kitty" > >fact: "I have a kitty" > > you could say: > if found? find fact cat [print x: "found it"] > > >How can i make the 2 values of cat: into a pattern > >that can be used in this script? Also, the rest of > >this script stinks... THERE MUST BE A BETTER WAY!!! > >
[REBOL] Newbie question #2 - Pattern making and using? Re:
Hi T Brownell you wrote: >x: none >cat: "feline" >cat: "kitty" >fact: "I have a kitty" >if found? find fact cat [x: "found it"] >if found? x [print x] >unset 'x A few remarks: >x: none this line is not necessary. But it's not a bad idea. >cat: "feline" >cat: "kitty" Now cat evaluates to "kitty" only! cat no longer evaluates to "feline"! If you try this code against fact: "I have a feline" find will fail! Given: >cat: "feline" >cat: "kitty" >fact: "I have a kitty" you could say: if found? find fact cat [print x: "found it"] >How can i make the 2 values of cat: into a pattern >that can be used in this script? Also, the rest of >this script stinks... THERE MUST BE A BETTER WAY!!! fact: "I have a kitty" rule:[ [thru "kitty" (x: "found kitty")] | [thru "feline" (x: "found feline") ] to end ] >> if parse fact rule [print x] found kitty fact: "I have a feline" >> if parse fact rule [print x] found feline To identify both in any order: fact-1: "The feline I have is a kitty." fact-2: "I have a kitty which is a feline" one possible approach is: rule:[ marker: [thru "kitty" (x-kitty: "found kitty")] :marker [thru "feline" (x-feline: "found feline") ] to end ] unset 'x-feline unset 'x-kitty if parse fact-1 rule [ if value? 'x-feline [print x-feline] if value? 'x-kitty [print x-kitty] ] unset 'x-feline unset 'x-kitty if parse fact-2 rule [ if value? 'x-feline [print x-feline] if value? 'x-kitty [print x-kitty] ] >> unset 'x-feline >> unset 'x-kitty >> >> if parse fact-1 rule [ [ if value? 'x-feline [print x-feline] [ if value? 'x-kitty [print x-kitty] [] found feline found kitty >> >> unset 'x-feline >> unset 'x-kitty >> >> if parse fact-2 rule [ [ if value? 'x-feline [print x-feline] [ if value? 'x-kitty [print x-kitty] [] found feline found kitty Hope this helps. ;- Elan >> [: - )]