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
;; for Sagittarius, Ypsilon | |
(import (rnrs) (time)) | |
;; for Mosh | |
;; (import (rnrs) (mosh)) | |
;; for Chez with --script option | |
;; (import (rnrs)) | |
;; for Vicare | |
;; (import (rnrs) (vicare)) | |
;; for Racket | |
;; (import (rnrs) (only (racket base) time)) |
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
;; generalised cut | |
;; (import (scheme base) (scheme write)) | |
(import (rnrs)) | |
;; FIXME I think there's a better way | |
(define-syntax remove-duplicate | |
(syntax-rules () | |
((_ (e* ...) reserve next) | |
(remove-duplicate "pair" () (e* ...) (e* ...) reserve next)) |
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
2015-10-24 | |
- Changed comment | |
- Walk though returning form to wrap. Racket still doesn't work. | |
- Fixed incorrect example on definition of macro and usage environment. | |
Comment of: https://twitter.com/anohana/status/657865512370634753 |
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 (scheme base) | |
(scheme write) | |
(rename (only (scheme base) car) (car r5rs:car))) | |
(define-syntax free-identifier=?? | |
(syntax-rules () | |
((_ a b) | |
(let-syntax ((foo (syntax-rules (a) | |
((_ a) #t) | |
((_ _) #f)))) |
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
#!r6rs | |
(import (rnrs)) | |
;; composing macro needs to be done CPS. | |
(define-syntax composem (syntax-rules ())) | |
(define-syntax extract/cps | |
(syntax-rules (composem extract/cps) | |
;; assume k is a macro which accepts cps in first argument | |
((_ (composem k) args ...) (k args ...)) | |
((_ (composem k k* ...) args ...) |
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 (scheme base) (scheme write)) | |
(define-syntax assocm | |
(syntax-rules () | |
((_ key (alist ...)) | |
(letrec-syntax ((foo (syntax-rules (key) | |
((_ (key . e) res (... ...)) '(key . e)) | |
((_ (a . d) res (... ...)) (foo res (... ...)))))) | |
(foo alist ...))))) |
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 (rnrs)) | |
(guard (e ((i/o-error? e) (display "&i/o-error: ") (display e)) | |
((assertion-violation? e) (display "&assertion: ") (display e)) | |
(else (display "other: ") (display e))) | |
(let ((in (open-bytevector-input-port #vu8(1 2 3 4 5)))) | |
(close-port in) | |
(get-u8 in))) | |
(flush-output-port (current-output-port)) | |
#| |
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
;; -*- mode: scheme -*- | |
#!r6rs | |
(library (prefixed-syntax-rules) | |
(export prefixed-syntax-rules) | |
(import (rnrs)) | |
(define-syntax prefixed-syntax-rules | |
(lambda (x) | |
(define (check-pattern p) | |
(define (prefiex? 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
(import (except (rnrs) cons) | |
(for (only (rnrs) cons syntax-case lambda | |
display newline syntax) expand (meta 2))) | |
(define-syntax foo | |
(lambda (x) | |
(define-syntax expand-phase | |
(lambda (x) | |
(display (cons 1 2)) (newline) | |
#'#t)) |
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
<html> | |
<head> | |
<title>Base64 encode/decode</title> | |
</head> | |
<body> | |
<form action="/base64" method="POST" enctype="multipart/form-data"> | |
Base64<br /> | |
<textarea name="base64" id="base64"></textarea> | |
<br /> | |
Plain<br /> |