blob: 638c13aedaf2b1c2a02722fed76b2810420d7a35 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
(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)))
((comment? y)
(list 'comment (comment-text 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))))
((recipe? y)
(list 'recipe (cook->list (recipe-metadata y))
(cook->list (recipe-body y))))
((list? y)
(map cook->list y))
(else y)))))
|