On Fri, Jul 5, 2013 at 1:13 PM, Adam Saleh <adamthecam...@gmail.com> wrote:
> Apologies, forgot that this is not a forum. > > 1) What would environment trimming provide me? Because right now I am > using core.logic quite naively, > mostly just applying recursion and some pattern matching. > Handling large inputs. If you're inputs aren't large then it's not a problem. > > 2) for starting I have implemented a simple regular grammar engine, > seems to work :) > > (def rules [ > ['N ['A "a"]] > ['A ['A "a"]] > ['A ["a"]] > ]) > > (defn re-matcho [current rules string] > (fresh [deriving remaining fst rst] > (membero [current deriving] rules) > (conso fst rst deriving) > (conde > [(== deriving string) (project [fst] (== true (not (symbol? > fst))))] > [(appendo remaining rst string) (re-matcho fst rules > remaining)]))) > > => (run 3 [q] > #_=> (re-matcho 'N rules q)) > (("a" "a") ("a" "a" "a") ("a" "a" "a" "a")) > => (run 3 [q] > #_=> (re-matcho 'N rules ["a" "a"])) > (_0) > => (run 3 [q] > #_=> (re-matcho 'N rules ["b" "a"])) > () > => (run 3 [q] > #_=> (re-matcho 'N rules [q "a"])) > ("a") Neat! :) -- -- 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.