blob: 5b6ddb2172d68d4572ec797971a055e9259fac4d (
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
35
36
37
38
|
(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
(($ <amount> quantity unit)
(list 'amount quantity unit))
(($ <comment> text)
(list 'comment text))
(($ <note> text)
(list 'note text))
(($ <section> name)
(list 'section name))
(($ <component> name amount)
(list 'component name (cook->list amount)))
(($ <cookware> name amount)
(list 'cookware name (cook->list amount)))
(($ <ingredient> name amount)
(list 'ingredient name (cook->list amount)))
(($ <timer> name amount)
(list 'timer name (cook->list amount)))
(($ <metadata-line> key value)
(list 'metadata-line key value))
(($ <step> elements)
(list 'step (map cook->list elements )))
((? hash-table? y)
(list 'metadata (cook->list (hash-table->alist y))))
(($ <recipe> metadata body)
(list 'recipe (cook->list metadata) (cook->list body)))
((? list? y)
(map cook->list y))
(else y)))))
|