This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ; 用語 | |
| ; - variable: identifierとsymbolの総称 | |
| ; すべての基本:識別子オブジェクト | |
| ; R4RSの言葉でいうと、eq?な識別子オブジェクトがbound-identifier=?、equal?な識別子オブジェクトがfree-identifier=?になる。 | |
| ; identifier=?な識別子オブジェクトはコンパイル後には同じ変数を指すことになる。 | |
| ; equal?は識別子どうしを比較するときはidentifier=?を呼ぶ。 | |
| (identifier? obj) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ; すべての基本:識別子オブジェクト | |
| ; R4RSの言葉でいうと、eq?な識別子オブジェクトがbound-identifier=?、equal?な識別子オブジェクトがfree-identifier=?になる。 | |
| ; equal?は識別子どうしを比較するときはidentifier=?を呼ぶ。 | |
| (identifier? obj) | |
| (identifier=? id ...) | |
| (make-identifier id env) | |
| (symbol->identifier sym [env]) | |
| (identifier->symbol id) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (define (p obj) | |
| (write obj) | |
| (newline) | |
| (flush-output-port) | |
| obj) | |
| ; expecting: | |
| ; | |
| ; (let-in-order ((x 1) | |
| ; (y 2)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ; tmpをrenameで作るのは間違ってる(というのがここでの主張) | |
| ; 単純なsymbol-to-symbolのα変換(capture-avoiding substitution)のうえに | |
| ; erを作っているとsrfi-72のlet-in-orderのような場合にバグる。 | |
| ; picrinでいうと、このissue -> https://github.com/picrin-scheme/picrin/issues/36 | |
| (define-syntax swap! | |
| (er-macro-transformer | |
| (lambda (e r c) | |
| (let ((a (car (cdr e))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (define-library (foo bar) | |
| (import (picrin base)) | |
| (begin | |
| (define (foo) | |
| (display "foo")) | |
| (define-syntax macro1 | |
| ; ここではfooは見えない | |
| ...)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (import (rename (picrin base) (define real-define))) | |
| (define-syntax my-lambda | |
| ; support docstrings | |
| ...) | |
| (define-syntax my-define | |
| (syntax-rules () | |
| ((_ var val) | |
| (real-define var val)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (* | |
| OCaml translation of the ideas explained in http://fumieval.hatenablog.com/entry/2014/09/22/144401 | |
| To emulate the higher kinded polymorphism, the technique used explained in https://ocamllabs.github.io/higher/lightweight-higher-kinded-polymorphism.pdf | |
| *) | |
| module StateMonad = struct | |
| type ('s, 'a) m = 's -> 's * 'a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (define-nitro r7rs | |
| (require callcc mutable-string)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #if 0 | |
| use strict; | |
| open IN, "./boot.c"; | |
| my @data = <IN>; | |
| close IN; | |
| open STDOUT, ">", "./boot.c"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #if 0 | |
| # ここはperlスクリプト(quine) | |
| compile_and_save <<EOL | |
| ; ココはschemeスクリプト | |
| (define (my-standard-function ...) | |
| ...) |