<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> ## 発表用スライド 1. 2021/10/15(Friday) [The Racket Guide 16.1](/381Aca4_RDOshAxIGIh25w?view) 2. 2021/10/29(Friday) [The Racket Guide 16.2](/z3PdlUX3Q8CfTzGvzJcKfg?view) 3. 2021/11/19 & 11/26(Freday) [Syntax-parse Introduction](/D3tiEFqMR2OShhrvNERdYA?view) 4. 2021/12/10(Friday) [研究開始](/ONLDrIqeQbuGg875BDU5Ow?view) --- ## syntax-parseの高速化 * [ありけんのHackMDまとめ](https://hackmd.io/@ariken-family/rknyKNrHK/https%3A%2F%2Fhackmd.io%2Fteam%2Fariken-family%3Fnav%3Doverview) * 実装が未完成.ちゃんと動くようにして性能評価もする.(matchとの融合もしたい.matchのパターンの一部にstxパターンとして混ぜて書ければ,ADTの代わりになれる.) * 参考:[syntax/parse](https://docs.racket-lang.org/syntax/stxparse.html) * syntax/parse [翻訳ver(作成中)](https://hackmd.io/mz2lAsHOT-qhp8-iRzgcjw) * 参考2:サンプル集 https://docs.racket-lang.org/syntax-parse-example/index.html ---- ## Schemeの速習 * [独習Scheme三週間](https://www.sampou.org/scheme/t-y-scheme/t-y-scheme-Z-H-1.html) * 8章まで読めば十分 * 11章以降のいくつかの章はRacketと無関係 * [公式ドキュメント](https://docs.racket-lang.org/) 1. [Quick: An Introduction to Racket with Pictures](https://docs.racket-lang.org/quick/index.html) * 10分ぐらいで終わる初歩の初歩 2. [The Racket Guide](https://docs.racket-lang.org/guide/index.html) * とりあえず2章「Racket Essentials」ぐらいまでを読む * その先は必要に応じて読む * ただし,16章「Macros」は必ず読むべし[(16章翻訳)](https://hackmd.io/e-USrwrzTkCvEJhxqOZJyg) * [Fear of Macros](https://www.greghendershott.com/fear-of-macros/)[(翻訳)](https://hackmd.io/2BTooD3wSEiqaR1dQ7vKEA) * マクロを理解する上で必読 * [個人メモ](https://hackmd.io/mvkP6godRJ-L8tytON3JwQ) --- ## 8/13 #### Emacsショートカット | キー入力 | できること | | -------- | -------- | | C-x C-f | 新規ファイル作成 | | C-c C-k or f5 | 実行及びコマンドプロンプト起動 | | alt-w | コピー | | C-w | カット | | C-y | ペースト | | C-x h | 全選択 | | C-x C-s | 保存 | | C-x C-c | 閉じる | --- ### hello.rkt ```racket= #lang racket ;Chapter1 ;Schemeに入力 ;最初のプログラム (begin (display "Hello, World!") ; コンソールに出力 (newline)) ; 改行復帰 ``` --- ### hello2-1.rkt ```racket= #lang racket ;Chapter2 ;データ型 ;2.1単純データ型 ;真理値 ;boolean (boolean? #t) ; #t (boolean? "Hello, World!") ; #f ;not (not #f) ; #t (not #t) ; #f (not "Hello, World!") ; #f ;数値 ;数値(number)、複素数(complex)、実数(real)、有理数(rational)、整数(integer) (number? 42) ; #t (number? #t) ; #f (complex? 2+3i) ; #t (real? 2+3i) ; #f (real? 3.1416) ; #t (real? 22/7) ; #t (real? 42) ; #t (rational? 2+3i) ; #f (rational? 3.1416) ; #t (rational? 22/7) ; #t (integer? 22/7) ; #f (integer? 42) ; #t ;数値の同値性 (eqv? 42 42) ; #t (eqv? 42 #f) ; #f (eqv? 42 42.0) ; #f (= 42 42) ; #t ;(= 42 #f) ; error (= 42 42.0) ; #t ;比較 (< 3 2) ; #f (>= 4.5 3) ; #t ;+、-、*、/、expt(xのn乗) (+ 1 2 3) ;6 (- 5.3 2) ;3.3 (- 5 2 1) ;2 (* 1 2 3) ;6 (/ 6 3) ;2 (/ 22 7) ;22/7 (/ 22 7.0) ;3.142857142857143 (expt 2 3) ;8 (expt 4 1/2) ;2.0 ;-と/は引数一つで符号逆転、逆数をとる (- 4) ;-4 (/ 4) ;1/4 ;最大値、最小値 (max 1 3 4 2 3) ;4 (min 1 3 4 2 3) ;1 ;absは絶対値を返す (abs 3) ;3 (abs -4) ;4 ;文字 ;文字述語 (char? #\c) ; #t (char? 1) ; #f (char? #\;) ; #t ;比較述語 (char=? #\a #\a) ; #t (char<? #\a #\b) ; #t (char>=? #\a #\b) ; #f ;大文字、小文字、比較 (char-ci=? #\a #\A) ; #t (char-ci<? #\a #\B) ; #t ;大文字、小文字、変換 (char-downcase #\A) ; #\a (char-upcase #\a) ; #\A ;シンボル (quote xyz) ; 'xyz 'E ; 'E ;シンボルかどうかチェック (symbol? 'xyz) ; #t (symbol? 42) ; #f ;Scheme のシンボルは通常、大文字と小文字を区別しない。 (eqv? 'Calorie 'calorie) ; #t ;グローバル変数 (define xyz 9) xyz ; xyz => 9 ;変数の変更 (set! xyz #\c) xyz ; xyz => #\c ``` --- 別のファイルでの定義を使用 例: test.rkt作成 (provide rainbow square)を記述 test2.rktを作成 #lang racket (require "test.rkt") (rainbow (square 5)) requireで使用可能になる --- https://docs.racket-lang.org/quick/index.html(10.マクロ ) ライブラリを2つ読み込むとき、 (require slideshow/code)だけではうまく使えなかったが (require slideshow slideshow/code)と記述することで回避 #lang racket (require slideshow slideshow/code) (define-syntax pict+code (syntax-rules () [(pict+code expr) (hc-append 10 expr (code expr))])) --- test.rkt #lang racket (require slideshow slideshow/code) (define-syntax pict+code (syntax-rules () [(pict+code expr) (hc-append 10 expr (code expr))])) (define (square n) ; A semi-colon starts a line comment. ; The expression below is the function body. (filled-rectangle n n)) (define (four p) (define two-p (hc-append p p)) (vc-append two-p two-p)) (define (checker p1 p2) (let ([p12 (hc-append p1 p2)] [p21 (hc-append p2 p1)]) (vc-append p12 p21))) (define (checkerboard p) (let* ([rp (colorize p "gray")] [bp (colorize p "black")] [c (checker rp bp)] [c4 (four c)]) (four c4))) ---
{"metaMigratedAt":"2023-06-16T06:44:59.811Z","metaMigratedFrom":"YAML","title":"syntax-parseの高速化(Home)","breaks":false,"slideOptions":"{\"theme\":\"white\",\"slideNumber\":\"c/t\",\"center\":false,\"transition\":\"none\",\"keyboard\":true,\"width\":\"93%\",\"height\":\"100%\"}","contributors":"[{\"id\":\"a0de3d6a-cf71-4961-a3bb-e324e7c21a77\",\"add\":9908,\"del\":1704}]"}
Expand menu