define-er-macro lambda no args bug?

Terry Cadd <[email protected]>
Newsgroups gmane.lisp.scheme.chicken
Message-ID <CAFy19QkLmbYZ-xsdFb1EOPob0t_GEtw09h3ncny62YVEaqO6yQ@mail.gmail.com>
;; CHICKEN
;; (c) 2008-2021, The CHICKEN Team
;; (c) 2000-2007, Felix L. Winkelmann
;; Version 5.3.0 (rev e31bbee5)
;; linux-unix-gnu-x86-64 [ 64bit dload ptables ]

(import (chicken pretty-print))
(import procedural-macros)

;; a simple un-hygienic macro that sets p to a lambda expression
;; using define-er-macro - errors out on lambda no args
;;
;; a lambda one arg is fine ...

(define-er-macro (foo-1)
  %
  `(,%set! p (,%lambda () 32)))
;; foo-1 definition rejected
;; => Error: (define-er-macro) "during expansion of (define-key-macro1672
...) - no nil in car position": ()

;; however a lambda with one argument is accepted
(define-er-macro (foo-2)
  %
  `(,%set! p (,%lambda (z) (+ z 32))))

;; and we can see the expanded code
(pp (expand '(foo-2)))
;; => (##core#set! p (lambda1575 (z) (+ z 32)))
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.