diff options
Diffstat (limited to 'scm/verbop.scm')
-rw-r--r-- | scm/verbop.scm | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/scm/verbop.scm b/scm/verbop.scm index 0fff38f..8308d70 100644 --- a/scm/verbop.scm +++ b/scm/verbop.scm @@ -121,28 +121,36 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (command-line))" "$@" (set! mood (append mood (list (cons key val))))) ;;; Conjugation is an associative list of moods (define conjugation #f) (define (get-conjugation) (let ((ret conjugation)) (set! conjugation #f) ret)) (define (conjugation-set key val) - (set! conjugation - (if conjugation - (append conjugation (list (cons key val))) - (list (cons key val))))) + (let ((elt (cond + ((not (eq? key #:root)) + (cons key val)) + ((and conjugation (assoc (car val) conjugation)) => + (lambda (entry) + (set-cdr! entry (cons (cdr val) (cdr entry))))) + (else + (cons key (list val)))))) + (set! conjugation + (if conjugation + (append conjugation (list elt)) + (list elt))))) ;;; Verb structure: (define verbdef '()) (define (verbdef:index c) (case c ((#:verb) 0) ((#:class) 1) ((#:action) 2) ((#:augment) 3) ((#:suffix) 4) @@ -213,32 +221,34 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (command-line))" "$@" (define (insert-individual-verb voice mood tense ident) (ellinika:sql-query "INSERT INTO individual_verb (verb,voice,mood,tense,ident) \ VALUES (~Q,~Q,~Q,~Q,~Q)" (verb-get #:verb) voice mood tense ident)) (define (flush-mood mood vstr) (if (eq? (car mood) #:root) - (let ((val (cdr mood))) - (ellinika:sql-query - "INSERT INTO irregular_root (verb,voice,thema,root) \ + (for-each + (lambda (val) + (ellinika:sql-query + "INSERT INTO irregular_root (verb,voice,thema,root) \ VALUES (~Q,~Q,~Q,~Q)" - (verb-get #:verb) - vstr - (car val) - (cdr val))) + (verb-get #:verb) + vstr + (car val) + (cdr val))) + (cdr mood)) (let ((mood-str (car mood))) (let ((lst (cdr mood))) (cond ((null? lst) (for-each (lambda (tense) (insert-individual-verb vstr mood-str tense 0)) (assoc-ref ellinika-tense-list mood-str))) (else ; (format #t "LST ~A~%" lst) (for-each |