me
/
guix
Archived
1
0
Fork 0

read-print: Add 'case' and 'cond' special forms.

* guix/read-print.scm (%special-forms): Add 'case' and 'cond'.
* tests/read-print.scm: Add tests.
Ludovic Courtès 2022-08-08 11:49:44 +02:00
parent ff9522fb69
commit 6db3b34d72
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
2 changed files with 17 additions and 0 deletions

View File

@ -255,6 +255,8 @@ expressions and blanks that were read."
;; symbol must appear within a (modify-phases ...) expression. ;; symbol must appear within a (modify-phases ...) expression.
(vhashq (vhashq
('begin 1) ('begin 1)
('case 2)
('cond 1)
('lambda 2) ('lambda 2)
('lambda* 2) ('lambda* 2)
('match-lambda 1) ('match-lambda 1)

View File

@ -141,6 +141,21 @@ expressions."
(let ((z (+ x y))) (let ((z (+ x y)))
(* z z)))") (* z z)))")
(test-pretty-print "\
(case x
((1)
'one)
((2)
'two))")
(test-pretty-print "\
(cond
((zero? x)
'zero)
((odd? x)
'odd)
(else #f))")
(test-pretty-print "\ (test-pretty-print "\
#~(string-append #$coreutils \"/bin/uname\")") #~(string-append #$coreutils \"/bin/uname\")")