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