[plt-scheme] Is it possible to define ' ` , like syntax?

From: Majorinc, Kazimir (kazimir at chem.pmf.hr)
Date: Tue Dec 11 00:30:20 EST 2007

Thanks Jos and Anton. (Also, thanks to all who answered on my previous 
question on printing procedures, I'll use some of the solutions.) Jos, 
if in your code 'lazy is replaced with 'dance, it appears to work even 
recursively. But I'm not sure. Is it true? What is the purpose of 'lazy 
and how it is understood, but only once?

;;;;;;;;;;;;;;;;;;
(define read-odd-char
 (case-lambda
  ((ch port src line col pos)
 #`(dance #,(read/recursive port #f (current-readtable))))
  ((ch port)
   (list 'lazy (read/recursive port #f (current-readtable))))))

(current-readtable
 (make-readtable #f
  #\° 'terminating-macro read-odd-char))

(define dance sqrt)

°4 ; ==> 2 --OK
(+ °9 °16) ; ==> 7 --OK
°(+ 9 16); ==> 5 --OK
°(+ °9 °16); ==> reference to undefined identifier: lazy

;;;;;;;;;;;;;;;;
If 'lazy is changed to 'dance, it appears it works.

--
Kazimir Majorinc



Posted on the users mailing list.