Hired a monkey to hit random keys on my keyboard, and eventually
figured out how to get the automaton working.

RegExp r = new RegExp("ab(c|d)*");
Automaton a = r.toAutomaton();
String s = "abcccdc";
System.out.println("Match: " + a.run(s)); // prints: true


(add-classpath "file:///home/boris/projects/chapter4/automaton.jar")
(import '(brics.automaton.RegExp))
(import '(brics.automaton.Automaton))
(import '(brics.automaton.RunAutomaton)) ; didn't succeed yet in
figuring out how to call this one.

(def r (.toAutomaton (dk.brics.automaton.RegExp. "[ab][c][abc][d]")))
(def s "acbd")
(.run r s)

Next part of the exploration is to figure out how to get it to find
substrings in a large string.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to