summaryrefslogtreecommitdiff
path: root/cook/debug.sld
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2024-08-10 16:04:45 +0200
committerEkaitz Zarraga <ekaitz@elenq.tech>2024-08-10 17:08:15 +0200
commit518fb8205ae251e10d642fc8816f0a6720e3b440 (patch)
tree1b68a4b791e7320275cdc8fbae088f47baa2599b /cook/debug.sld
parentd720bcd8aa948fb58087ca9c11a8c8c5ab52db4b (diff)
Make some project structure
Diffstat (limited to 'cook/debug.sld')
-rw-r--r--cook/debug.sld29
1 files changed, 29 insertions, 0 deletions
diff --git a/cook/debug.sld b/cook/debug.sld
new file mode 100644
index 0000000..9ae9638
--- /dev/null
+++ b/cook/debug.sld
@@ -0,0 +1,29 @@
+(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)))))