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 (circular-list? x) | |
(and (pair? x) | |
(let rec ((lst (cdr x))) | |
(cond ((not (pair? lst)) #f) | |
((null? lst) #f) | |
((eq? x lst) #t) | |
(else (rec (cdr lst))))))) | |
* * * * | |
.git/ .travis.yml Makefile etc/ lib/ t/ | |
.gitignore AUTHORS README.md extlib/ piclib/ tools/ |
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
cd src; \ | |
yacc -d parse.y; \ | |
flex scan.l | |
cc -Wall -Wextra -std=c99 -g -DDEBUG=1 -O0 -shared -fPIC src/*.c -o lib/libpicrin.so -I./include -I./extlib -L./lib -lm -lxfile | |
src/codegen.c: 関数 ‘global_def’ 内: | |
src/codegen.c:1467:38: 警告: 符号付きと符号無しの整数式の間での比較です [-Wsign-compare] | |
if ((gidx = global_ref(pic, name)) != -1) { | |
^ | |
lex.yy.c: 関数 ‘yy_scan_bytes’ 内: | |
lex.yy.c:1857:17: 警告: 符号付きと符号無しの整数式の間での比較です [-Wsign-compare] |
This file has been truncated, but you can view the full file.
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
~/picrin-stibear/picrin $ make run | |
bin/picrin | |
gc run! | |
sym_pool realloced | |
gc run! | |
gc run! | |
gc run! | |
gc run! | |
sym_pool realloced | |
gc run! |
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 (scheme record) | |
(import (scheme base) | |
(scheme cxr) | |
(picrin macro)) | |
(define record-marker (list 'record-marker)) | |
(define real-vector? vector?) | |
(define (vector? x) |
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-record-type pare | |
(kons x y) | |
pare? | |
(x kar) | |
(y kdr)) | |
(kons 'a 'b) ;=> #<record pare> |
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 count 0) | |
(define end 5) | |
(define p | |
(delay | |
(begin (set! count (+ count 1)) | |
(if (> count end) | |
count | |
(force p))))) | |
(force p) ; runtime error: invalid application: #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
(define count 0) | |
(define x 5) | |
(define p | |
(delay | |
(begin (set! count (+ count 1)) | |
(* x 3)))) | |
(force p) ; runtime error: invalid application: #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
(define-syntax cut | |
(ir-macro-transformer | |
(lambda (form inject compare?) | |
`(cut% () () ,@(cdr form))))) | |
;; ir-macro-transformer version | |
(define-syntax cut% | |
(ir-macro-transformer | |
(lambda (form inject compare?) | |
(let ((slots (cadr form)) |
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-syntax cut% | |
(sc-macro-transformer | |
(lambda (form env) | |
(letrec ((map-msc | |
(lambda (x) | |
(map (lambda (ex) | |
(make-syntactic-closure env '(<> <...>) ex)) | |
x)))) | |
(let ((slots (cadr form)) | |
(combi (caddr form)) |
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-syntax cut | |
(syntax-rules () | |
((cut . slots-or-exprs) | |
(srfi-26-internal-cut () () . slots-or-exprs)))) | |
(define-syntax cut-sc | |
(sc-macro-transformer | |
(lambda (form env) | |
`(cut%-sc () () ,@(map (lambda (ex) | |
(make-syntactic-closure env '() ex)) |