diff options
author | Bruno Cichon <ebrasca.ebrasca@openmailbox.org> | 2017-02-24 01:52:56 +0100 |
---|---|---|
committer | Bruno Cichon <ebrasca.ebrasca@openmailbox.org> | 2017-02-24 01:52:56 +0100 |
commit | 8fd25145566cf4f1f6df21ce960f87342a3f037a (patch) | |
tree | 4ccb06f36fbe455562639a29590e698716a2cbfa /src/l-system.lisp | |
parent | b94d84cf431e3ca480d01ff277bf40463da09224 (diff) |
Fix rules. Add conditions in rules.
Diffstat (limited to 'src/l-system.lisp')
-rw-r--r-- | src/l-system.lisp | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/src/l-system.lisp b/src/l-system.lisp index 1ea07fe..2f39259 100644 --- a/src/l-system.lisp +++ b/src/l-system.lisp @@ -36,27 +36,9 @@ It can expand to parametric grammar or to context sensitive grammar." (list `(,symbol1 ,@parameters1)))) (setf symbol0 (first (first elt))))) -(defmacro setf-l-system-rule (symbol lambda) - "Set rules to grammar." - `(setf (gethash ,symbol *l-system-clauses*) - ,lambda)) - -(defun make-l-system-expr (item) - "(Symbol . paremetes)" - `(list ',(first item) ,@(rest item))) - -(defun make-l-system-list (rest) - "Make rule conversion part." - (iter (for item in rest) - (collecting (make-l-system-expr item)))) - -(defmacro make-l-system-rule (vars &body body) - "Define rule for grammar." - `#'(lambda ,(append vars '(&rest rest)) - (declare (ignorable rest)) - (list ,@(make-l-system-list body)))) - (defmacro -> (symbol vars &body body) "Define and set rules to grammar." - `(setf-l-system-rule ',symbol - (make-l-system-rule ,vars ,@body))) + `(setf (gethash ',symbol *l-system-clauses*) + #'(lambda ,(append vars '(&rest rest)) + (declare (ignorable rest)) + ,@body))) |