owned this note
owned this note
Published
Linked with GitHub
---
title: Fear of Macros
tags: macro
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>
## マクロの恐怖
by Greg Hendershott
![](https://i.imgur.com/pPHRvMh.jpg)
Racketのマクロについての実用的なガイドです。
* [1 はじめに](https://hackmd.io/rRfacGHSTWKOLiErxhY-fw?view)
* [2 私たちの進攻計画](https://hackmd.io/CciUmfpTTr6mBAx_84giOQ?view)
* [3 変形!](https://hackmd.io/xLxLlckORtSxKWclYNtJ0Q?view)
* [3.1 シンタックストランスフォーマーとは?](https://hackmd.io/xLxLlckORtSxKWclYNtJ0Q?both#31-%E3%82%B7%E3%83%B3%E3%82%BF%E3%83%83%E3%82%AF%E3%82%B9%E3%83%88%E3%83%A9%E3%83%B3%E3%82%B9%E3%83%95%E3%82%A9%E3%83%BC%E3%83%9E%E3%83%BC%E3%81%A8%E3%81%AF%EF%BC%9F)
* [3.2 入力とは何でしょう?](https://hackmd.io/xLxLlckORtSxKWclYNtJ0Q?both#32-%E5%85%A5%E5%8A%9B%E3%81%A8%E3%81%AF%EF%BC%9F)
* [3.3 入力を実際に変換する](https://hackmd.io/xLxLlckORtSxKWclYNtJ0Q?both#33-%E5%85%A5%E5%8A%9B%E3%82%92%E5%AE%9F%E9%9A%9B%E3%81%AB%E5%A4%89%E6%8F%9B%E3%81%99%E3%82%8B)
* [3.4 コンパイル時とランタイム時の比較](https://hackmd.io/xLxLlckORtSxKWclYNtJ0Q?both#34-%E3%82%B3%E3%83%B3%E3%83%91%E3%82%A4%E3%83%AB%E6%99%82%E3%81%A8%E3%83%A9%E3%83%B3%E3%82%BF%E3%82%A4%E3%83%A0%E6%99%82%E3%81%AE%E6%AF%94%E8%BC%83)
* [3.5 シンタックスのための開始](https://hackmd.io/xLxLlckORtSxKWclYNtJ0Q?both#35-for-syntax%E3%81%AE%E9%96%8B%E5%A7%8B)
* [4 パターンマッチング: syntax-case と syntax-rules](https://hackmd.io/Nk0tT1F8St2-iu07-mqllA?view)
* [4.1 パターン変数とテンプレートの戦い](https://hackmd.io/Nk0tT1F8St2-iu07-mqllA?view#41-%E3%83%91%E3%82%BF%E3%83%BC%E3%83%B3%E5%A4%89%E6%95%B0%E3%81%A8%E3%83%86%E3%83%B3%E3%83%97%E3%83%AC%E3%83%BC%E3%83%88%E3%81%AE%E6%88%A6%E3%81%84)
* [4.1.1 with-syntax](https://hackmd.io/Nk0tT1F8St2-iu07-mqllA?view#411-with-syntax)
* [4.1.2 with-syntax*(ウィズシンタックス](https://hackmd.io/Nk0tT1F8St2-iu07-mqllA?view#412-with-syntax)
* [4.1.3 format-id](https://hackmd.io/Nk0tT1F8St2-iu07-mqllA?view#413-format-id)
* [4.1.4 別の例](https://hackmd.io/Nk0tT1F8St2-iu07-mqllA?view#414-%E5%88%A5%E3%81%AE%E4%BE%8B)
* [4.2 独自の構造体を作る](https://hackmd.io/Nk0tT1F8St2-iu07-mqllA?view#42-%E7%8B%AC%E8%87%AA%E3%81%AE%E6%A7%8B%E9%80%A0%E4%BD%93%E3%82%92%E4%BD%9C%E3%82%8B)
* [4.3 ドット記法を使ったハッシュの入れ子検索](https://hackmd.io/Nk0tT1F8St2-iu07-mqllA?view#43-%E5%85%A5%E3%82%8C%E5%AD%90%E3%81%AB%E3%81%AA%E3%81%A3%E3%81%9F%E3%83%8F%E3%83%83%E3%82%B7%E3%83%A5%E6%A4%9C%E7%B4%A2%E3%81%AB%E3%83%89%E3%83%83%E3%83%88%E8%A8%98%E6%B3%95%E3%82%92%E4%BD%BF%E3%81%86)
* [5 構文パラメータ](https://hackmd.io/Hi_rX5oZTLKILvCF-QL6Lw?view)
* [6 splicing-letは何のために存在するのか?](https://hackmd.io/VlVQKufDTLy0jraU2UFusQ?view)
* [7 堅牢なマクロ:syntax-parse](https://hackmd.io/sCt8NNyTTc6XyPrCCaMIPw?view)
* [7.1 関数のエラー処理方法](https://hackmd.io/sCt8NNyTTc6XyPrCCaMIPw?view#71-%E9%96%A2%E6%95%B0%E3%81%AE%E3%82%A8%E3%83%A9%E3%83%BC%E5%87%A6%E7%90%86%E6%88%A6%E7%95%A5)
* [7.2 マクロのエラー処理戦略](https://hackmd.io/sCt8NNyTTc6XyPrCCaMIPw?view#72-%E3%83%9E%E3%82%AF%E3%83%AD%E3%81%AE%E3%82%A8%E3%83%A9%E3%83%BC%E5%87%A6%E7%90%86%E6%88%A6%E7%95%A5)
* [7.3 syntax-parseの使い方](https://hackmd.io/sCt8NNyTTc6XyPrCCaMIPw?view#73-syntax-parse%E3%81%AE%E4%BD%BF%E7%94%A8)
* [8 参考文献と謝辞](https://hackmd.io/4HqQUdbNT6KJbyLxYf80WQ?view)