guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: with-slot syntax how to


From: Marco Maggi
Subject: Re: with-slot syntax how to
Date: Sat, 13 Oct 2007 08:12:15 +0200

damn:

(define-syntax with-slots
  (syntax-rules ()
    ;;this  is here  only to  let  me remove  the bindings
while
    ;;debugging the form
    ((_ ((() () ?object)) ?form ...)
     (begin ?form ...))

    ((_ (((?sym ...) (?slot ...) ?object)) ?form ...)
     (let ((?sym (slot-ref ?object '?slot))
           ...)
       ?form ...))

    ((_ (((?sym1 ...) (?slot1 ...) ?object1)
         ((?sym2 ...) (?slot2 ...) ?object2)
         ...) ?form ...)
     (with-slots (((?sym1 ...) (?slot1 ...) ?object1))
       (with-slots (((?sym2 ...) (?slot2 ...) ?object2) ...)
         ?form ...)))))

--
Marco Maggi

"Now feel the funk blast!"
Rage Against the Machine - "Calm like a bomb"






reply via email to

[Prev in Thread] Current Thread [Next in Thread]