@@ -51,16 +51,32 @@ ;; (("ANIMAL" "Elephant") ("SEASON" "Fall")) ;; (("ANIMAL" "Lion") ("SEASON" "Spring")) ;; (("ANIMAL" "Lion") ("SEASON" "Fall"))) (define (item-assoc->item-list itemsdat) (if (and itemsdat (not (null? itemsdat))) - (let ((itemlst (map (lambda (x) - (let ((name (car x)) - (items (cadr x))) - (list name (string-split items)))) - itemsdat))) - (process-itemlist #f '() itemlst)) + (let ((itemlst (filter (lambda (x) + (list? x)) + (map (lambda (x) + (debug:print 6 "item-assoc->item-list x: " x) + (if (< (length x) 2) + (begin + (debug:print 0 "ERROR: malformed items spec " (string-intersperse x " ")) + (list (car x)'())) + (let ((name (car x)) + (items (cadr x))) + (list name (string-split items))))) + itemsdat)))) + (let ((debuglevel 5)) + (debug:print 5 "item-assoc->item-list: itemsdat => itemlst ") + (if (>= *verbosity* 5) + (begin + (pp itemsdat) + (print " => ") + (pp itemlst)))) + (if (> (length itemlst) 0) + (process-itemlist #f '() itemlst) + '())) '())) ;; return a list consisting on a single null list for non-item runs ;; Nope, not now, return null as of 6/6/2011 ;; (item-table->item-list '(("ANIMAL" "Elephant Lion")("SEASON" "Spring Winter"))) ;; => ((("ANIMAL" "Elephant")("SEASON" "Spring")) @@ -68,11 +84,11 @@ (define (item-table->item-list itemtable) (let ((newlst (map (lambda (x) (if (> (length x) 1) (list (car x) (string-split (cadr x))) - x)) + (list x '()))) itemtable)) (res '())) ;; a list of items (let loop ((indx 0) (item '()) ;; an item will be ((KEYNAME1 VAL1)(KEYNAME2 VAL2) ...) (elflag #f))