home *** CD-ROM | disk | FTP | other *** search
/ Dream 44 / Amiga_Dream_44.iso / RiscPc / programmation / scm4e2.arc / !Scm / scm / macros < prev    next >
Text File  |  1994-04-18  |  342b  |  25 lines

  1. ;
  2. ; Simple examples of macros
  3. ; ams 14/4/94
  4. ;
  5.  
  6. (define c
  7.     (procedure->macro
  8.         (lambda (x env) `(define ,(cadr x) ,(caddr x)))
  9.     )
  10. )
  11.  
  12. ;
  13. ; Now try (c r 5) and then accessing r
  14. ; also (c a2 (lambda (x)(+ x 2))) and (a2 4)
  15. ;
  16. (define lise-args
  17.     (procedure->macro
  18.         (lambda (x env) `(lambda () ,(cdr x)))
  19.     )
  20. )
  21.  
  22. ;
  23. ; try (lise-args (+ 2 4) (+ 5 6))
  24. ;
  25.