Created
December 18, 2012 00:07
-
-
Save jirkamarsik/4323622 to your computer and use it in GitHub Desktop.
An example of a non-trivial core.logic predicate.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn ^::rule fix-adjunctiono | |
"A rule which takes a left-most or right-most child A, which is an | |
adjunct, and puts the A on a separate level from the other children, | |
i.e. (R A ...) -> (R A (R ...)) or (R ... A) -> (R (R ...) A). | |
This solves the general case when modifiers and adjuncts end up as | |
children of the consituent they modify (e.g. in VPs)." | |
[in-tree out-tree] | |
(fresh [root children other-children adjunct head-child] | |
(conso root children in-tree) | |
(has-more-thano 2 children) | |
(conde [(conso adjunct other-children children) | |
(== out-tree (list root adjunct head-child))] | |
[(appendo other-children (list adjunct) children) | |
(== out-tree (list root head-child adjunct))]) | |
(conso root other-children head-child) | |
(adjuncto in-tree adjunct))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment