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.
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")
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
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
---
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.