Changeset 14992 in project


Ignore:
Timestamp:
06/14/09 20:06:27 (10 years ago)
Author:
felix winkelmann
Message:

fix in macro tutorial; added r4 ftp wikipage

Location:
wiki
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/explicit-renaming-macros

    r14966 r14992  
    1 Mini-tutorial on explicit renaming macros in Chicken
    2 ----------------------------------------------------
     1== Mini-tutorial on explicit renaming macros in Chicken
    32
    4 Author: Juergen Lorenz
    5         ju (at) jugilo (dot) de
     3Author: Juergen Lorenz   {{ju (at) jugilo (dot) de}}
    64Date:   Jun 9th, 2009
    75
     
    4644        (y (caddr form))
    4745        )
    48         `(let ((tmp ,x))
    49            (set! ,x ,y)
    50            (set! ,y tmp)))))
     46        `(let ((tmp ,x))
     47           (set! ,x ,y)
     48           (set! ,y tmp)))))
    5149
    5250In this form, the new macro is the same as our first attempt with
     
    9189        (y (caddr form))
    9290        )
    93         `(,(rename 'let) ((,(rename 'tmp) ,x))
    94            (,(rename 'set!) ,x ,y)
    95            (,(rename 'set!) ,y ,(rename 'tmp))))))
     91        `(,(rename 'let) ((,(rename 'tmp) ,x))
     92           (,(rename 'set!) ,x ,y)
     93           (,(rename 'set!) ,y ,(rename 'tmp))))))
    9694
    9795If you repeat the expand call above, you will get the same replacement
     
    122120        (%set! (rename 'set!))
    123121        )
    124         `(,%let ((,%tmp ,x))
    125            (,%set! ,x ,y)
    126            (,%set! ,y ,%tmp)))))
     122        `(,%let ((,%tmp ,x))
     123           (,%set! ,x ,y)
     124           (,%set! ,y ,%tmp)))))
    127125
    128126You can think of the two characters ,% as an identity operator.
Note: See TracChangeset for help on using the changeset viewer.