This file contains 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
class _Main { | |
static function main (args : string[]) : void { | |
function * prime () : number { | |
NEXT: | |
for (var n = 2; true; ++n) { | |
for (var m = 2; m * m <= n; ++m) { | |
if (n % m == 0) | |
continue NEXT; | |
} | |
yield n; |
This file contains 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
.text | |
.align 2 | |
.globl printf2 | |
printf2: | |
# %r3 void *fmt | |
# %r14 const char *fmt | |
# %r15 void *ap | |
# %r16 char c | |
# %r17 char *str |
This file contains 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
$ make run | |
warn: redefining variable: wr-lst@1734 | |
warn: redefining variable: pp-expr@1773 | |
warn: redefining variable: pp-call@1774 | |
warn: redefining variable: pp-list@1772 | |
warn: redefining variable: pp-down@1775 | |
warn: redefining variable: pp-general@1776 | |
warn: redefining variable: tail2@1825 | |
warn: redefining variable: tail3@1826 | |
warn: redefining variable: indent-general@1778 |
This file contains 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
/* | |
* C-side API | |
*/ | |
struct my_data { | |
// blah blah blah | |
}; | |
struct my_data * | |
create_my_data () |
This file contains 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
type false_t = { any : 'a.'a };; | |
type 'a not_t = 'a -> false_t;; | |
type ('a,'b) and_t = 'a * 'b;; | |
type ('a,'b) or_t = L of 'a | R of 'b;; | |
(* ('a->'b)->('b->'c)->('a->'c) *) | |
let f1 f g x = g (f x);; |
This file contains 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 (lib) | |
(import (scheme base)) | |
(define foo 1) | |
(export foo)) | |
(define-library (lib2) | |
(import (scheme base)) |
This file contains 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 (my lib) | |
(import (scheme base)) | |
(define foo 1) | |
(define bar 2) | |
(export foo) | |
(export (rename bar baz))) | |
This file contains 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
(dictionary . plist) | |
(dictionary? obj) | |
(dictionary-ref dict key) | |
(dictionary-set! dict key value) | |
(dictionary-has? dict key) | |
(dictionary-delete dict key) | |
(dictionary-size dict) | |
; conversions | |
(dictionary->plist dict) |
This file contains 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
; Thinking of reader macros for a while, I found that | |
; `in-library` can be the silver bullet of it. | |
(define-library (foo) | |
(import (picrin keyword)) ; it is assumed that (picrin keyword) exports a reader syntax :foo. | |
; here you can do everything but using keyword syntax like :foo, because | |
; import of (picrin keyword) is processed after the top level expression `(define-library ...)` has | |
; fully read. | |
This file contains 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
.align 2 | |
.globl prod | |
prod: | |
lda $30, -16($30) | |
stq $26, 0($30) | |
stq $15, 8($30) | |
mov $30, $15 | |
xor $0, $0, $0 | |
for: |
OlderNewer