---
title: 16.2
tags: The Racket Guide
slideOptions:
theme: white
slideNumber: 'c/t'
center: false
transition: 'none'
keyboard: true
width: '93%'
height: '100%'
---
<style>
/* basic design */
.reveal h1, .reveal h2, .reveal h3, .reveal h4, .reveal h5, .reveal h6,
.reveal section, .reveal table, .reveal li, .reveal blockquote, .reveal th, .reveal td, .reveal p {
font-family: 'Meiryo UI', 'Source Sans Pro', Helvetica, sans-serif, 'Helvetica Neue', 'Helvetica', 'Arial', 'Hiragino Sans', 'ヒラギノ角ゴシック', YuGothic, 'Yu Gothic';
text-align: left;
line-height: 1.8;
letter-spacing: normal;
text-shadow: none;
word-wrap: break-word;
color: #444;
}
.reveal h1, .reveal h2, .reveal h3, .reveal h4, .reveal h5 {font-weight: normal;}, .reveal h6 {font-weight: bold;}
.reveal h1, .reveal h2, .reveal h3 {color: #2980b9;}
.reveal th {background: #DDD;}
.reveal section img {background:none; border:none; box-shadow:none; max-width: 95%; max-height: 95%;}
.reveal blockquote {width: 90%; padding: 0.5vw 3.0vw;}
.reveal table {margin: 1.0vw auto;}
.reveal code {line-height: 1.2;}
.reveal p, .reveal li {padding: 0vw; margin: 0vw;}
.reveal .box {margin: -0.5vw 1.5vw 2.0vw -1.5vw; padding: 0.5vw 1.5vw 0.5vw 1.5vw; background: #EEE; border-radius: 1.5vw;}
/* table design */
.reveal table {background: #f5f5f5;}
.reveal th {background: #444; color: #fff;}
.reveal td {position: relative; transition: all 300ms;}
.reveal tbody:hover td { color: transparent; text-shadow: 0 0 3px #aaa;}
.reveal tbody:hover tr:hover td {color: #444; text-shadow: 0 1px 0 #fff;}
/* blockquote design */
.reveal blockquote {
width: 90%;
padding: 0.5vw 0 0.5vw 6.0vw;
font-style: italic;
background: #f5f5f5;
}
.reveal blockquote:before{
position: absolute;
top: 0.1vw;
left: 1vw;
content: "\f10d";
font-family: FontAwesome;
color: #2980b9;
font-size: 3.0vw;
}
/* font size */
.reveal h1 {font-size: 5.0vw;}
.reveal h2 {font-size: 3.0vw;}
.reveal h3 {font-size: 2.8vw;}
.reveal h4 {font-size: 2.6vw;}
.reveal h5 {font-size: 1.8vw;}
.reveal h6 {font-size: 2.2vw;}
.reveal section, .reveal table, .reveal li, .reveal blockquote, .reveal th, .reveal td, .reveal p {font-size: 2.2vw;}
.reveal code {font-size: 1.6vw;}
/* new color */
.red {color: #EE6557;}
.blue {color: #16A6B6;}
/* split slide */
#right {left: -18.33%; text-align: left; float: left; width: 50%; z-index: -10;}
#left {left: 31.25%; text-align: left; float: left; width: 50%; z-index: -10;}
</style>
<style>
/* specific design */
.reveal h1 {
margin: 0% -100%;
padding: 2% 100% 4% 100%;
color: #fff;
background: #fffa5e; /* fallback for old browsers */
background: linear-gradient(-45deg, #f7f439, #54ffa4, #23A6D5, #238ed5);
background-size: 200% 200%;
animation: Gradient 60s ease infinite;
}
@keyframes Gradient {
0% {background-position: 0% 50%}
50% {background-position: 100% 50%}
100% {background-position: 0% 50%}
}
.reveal h2 {
text-align: center;
margin: -5% -50% 2% -50%;
padding: 3% 10% 1% 10%;
color: #fff;
background: #fffa5e; /* fallback for old browsers */
background: -webkit-linear-gradient(to right, #c74646, #fffa5e); /* Chrome 10-25, Safari 5.1-6 */
background: linear-gradient(to right, #c74646, #fffa5e); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
}
.reveal h4 {
text-align: center;
}
</style>
---
## 16.2 一般的なマクロトランスフォーマー
define-syntax形式では、識別子に対する変換バインディングを作成します。これは、コンパイル時に使用できるバインディングで、実行時に評価される式を展開します。変換バインディングに関連するコンパイル時の値は何でもよいのですが、もしそれが1つの引数のプロシージャであれば、そのバインディングはマクロとして使われ、そのプロシージャがマクロ変換器となります。
* [16.2.1 構文オブジェクト](https://hackmd.io/PnldatcwRTKHhcpWum5bBg#1621-%E6%A7%8B%E6%96%87%E3%82%AA%E3%83%96%E3%82%B8%E3%82%A7%E3%82%AF%E3%83%88)
* [16.2.2 マクロトランスフォーマ手続き](https://hackmd.io/1lLwBBBIR6C0wpRuqZtOtw)
* [16.2.3 パターンと表現の混在:syntax-case](https://hackmd.io/AVXmTZ3fRKGcvTnASidqyQ#1623-%E3%83%91%E3%82%BF%E3%83%BC%E3%83%B3%E3%81%A8%E8%A1%A8%E7%8F%BE%E3%81%AE%E6%B7%B7%E5%9C%A8%EF%BC%9Asyntax-case)
* [16.2.4 with-syntaxとgenerate-temporaries](https://hackmd.io/DIzp79gETviwu1oC1xiqOg#1624-with-syntax%E3%81%A8generate-temporaries)
* [16.2.5 コンパイルとランタイムの段階](https://hackmd.io/wRUrzYlXROilIxXRmY6ucg#1625-%E3%82%B3%E3%83%B3%E3%83%91%E3%82%A4%E3%83%AB%E3%81%A8%E3%83%A9%E3%83%B3%E3%82%BF%E3%82%A4%E3%83%A0%E3%81%AE%E6%AE%B5%E9%9A%8E)
* [16.2.6 一般的なフェーズレベル](https://hackmd.io/kkYlJHOyQ8C1ncqfI60KJQ#1626-%E4%B8%80%E8%88%AC%E7%9A%84%E3%81%AA%E3%83%95%E3%82%A7%E3%83%BC%E3%82%BA%E3%83%AC%E3%83%99%E3%83%AB)
* [16.2.6.1 フェーズとバインディング](https://hackmd.io/kkYlJHOyQ8C1ncqfI60KJQ#16261-%E3%83%95%E3%82%A7%E3%83%BC%E3%82%BA%E3%81%A8%E3%83%90%E3%82%A4%E3%83%B3%E3%83%87%E3%82%A3%E3%83%B3%E3%82%B0)
* [16.2.6.2 フェーズとモジュール](https://hackmd.io/kkYlJHOyQ8C1ncqfI60KJQ#16262-%E3%83%95%E3%82%A7%E3%83%BC%E3%82%BA%E3%81%A8%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB)
* [16.2.7 コードインスペクタと構文汚染](https://hackmd.io/YwkWRz5zRVSloSQTJ5qxFw#1627-%E3%82%B3%E3%83%BC%E3%83%89%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%9A%E3%82%AF%E3%82%BF%E3%81%A8%E6%A7%8B%E6%96%87%E3%81%AE%E4%B9%B1%E3%82%8C)
* [16.2.7.1 マクロの結果に対するsyntax-protectの使用](https://hackmd.io/YwkWRz5zRVSloSQTJ5qxFw#16271-%E3%83%9E%E3%82%AF%E3%83%AD%E3%81%AE%E7%B5%90%E6%9E%9C%E3%81%AB%E5%AF%BE%E3%81%99%E3%82%8Bsyntax-protect%E3%81%AE%E4%BD%BF%E7%94%A8)
* [16.2.7.2 染色モード](https://hackmd.io/YwkWRz5zRVSloSQTJ5qxFw#16272-%E6%9F%93%E8%89%B2%E3%83%A2%E3%83%BC%E3%83%89)
* [16.2.7.3 汚れとコードインスペクタ](https://hackmd.io/YwkWRz5zRVSloSQTJ5qxFw#16273-%E6%B1%9A%E3%82%8C%E3%81%A8%E3%82%B3%E3%83%BC%E3%83%89%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%9A%E3%82%AF%E3%82%BF)
* [16.2.7.4 保護されたエクスポート](https://hackmd.io/YwkWRz5zRVSloSQTJ5qxFw#16274-%E4%BF%9D%E8%AD%B7%E3%81%95%E3%82%8C%E3%81%9F%E3%82%A8%E3%82%AF%E3%82%B9%E3%83%9D%E3%83%BC%E3%83%88)