(define-library (cook debug) (export cook->list) (import (srfi 1) (srfi 9) (srfi 69) (chibi) (chibi match) (cook parse-internals)) (begin (define (cook->list y) (match y (($ quantity unit) (list 'amount quantity unit)) (($ text) (list 'comment text)) (($ text) (list 'note text)) (($ name amount) (list 'component name (cook->list amount))) (($ name amount) (list 'cookware name (cook->list amount))) (($ name amount) (list 'ingredient name (cook->list amount))) (($ name amount) (list 'timer name (cook->list amount))) (($ key value) (list 'metadata-line key value)) (($ elements) (list 'step (map cook->list elements ))) ((? hash-table? y) (list 'metadata (cook->list (hash-table->alist y)))) (($ metadata body) (list 'recipe (cook->list metadata) (cook->list body))) ((? list? y) (map cook->list y)) (else y)))))