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
(use-modules (ice-9 match))
(define (serialize-sway-expression expr)
(format #t "expres. ~a\n" expr)
(match expr
((term ((exprs ...) ...))
(format #t "subtop. ~a . ~a\n" term exprs)
(serialize-sway-subconfig exprs))
(else (display "Correct behavior.\n") "Correct behavior.")))
(define (serialize-sway-subconfig subconfig)
(format #t "subcfg. ~a\n" subconfig)
(match subconfig
(((exprs ...) ...)
(apply string-append
;;; 1. if we wrap it into lambda, the subconfig
;;; function is starting to behave:
;; (map (lambda (e) (serialize-sway-expression e)) exprs) ; Correct
(map serialize-sway-expression exprs) ; Wrong
))
(else (display "Wrong behavior!\n") "Wrong behavior!")))
;;; 2. if we add tracing the subconfig function is starting to behave
;;; The era of quantum computing is already here?
;; (use-modules (system vm trace))
;; (trace-calls-in-procedure serialize-sway-subconfig)
(serialize-sway-subconfig '((input "*" ((xkb_layout us,ru)
(xkb_variant dvorak,)))))
;; (call-with-trace
;; (lambda ()
;; (serialize-sway-subconfig '((input "*" ((xkb_layout us,ru)
;; (xkb_variant dvorak,)))))))