If I understand correctly, this is the 90% solution

(define-syntax car+
  (lambda (o)
    (syntax-case o ()
      ((_ e) #`(let ((p e)) (if (pair? p) (car p) (error 'car+ "not a
pair" p #'#,o))))
      (i (identifier? #'i)
        #`(lambda (p) (if (pair? p) (car p) (error 'car+ "not a pair"
p #'#,o)))))))

does anyone know how to avoid duplicating all that code?

On Fri, May 1, 2009 at 7:09 PM, Abdulaziz Ghuloum <[email protected]> wrote:
>
> On May 1, 2009, at 12:02 PM, Ramana Kumar wrote:
>
>>  I could return a
>> procedure that calls car+ in the body, but the syntax information
>> won't match the call site of the created procedure (it will match the
>> call to car+ in its body).
>
> Of course not.  So, calling (map car+ '(1)) would show you which car+
> was used; it will not show you the occurrence of calling f inside the
> code for map (which is not too useful).  Anyways, I said it's a 90%
> solution.
>
> Aziz,,,
>

Reply via email to