gather utility functions which are necessary in bootstrap stage

This commit is contained in:
Yuichi Nishiwaki 2013-12-10 09:14:08 -08:00
parent eb4202cf34
commit 55105dc14f
1 changed files with 21 additions and 22 deletions

View File

@ -40,10 +40,9 @@
er-macro-transformer
ir-macro-transformer))
;;; core syntaces
(define-library (picrin core-syntax)
(import (scheme base)
(picrin macro))
;;; bootstrap utilities
(define-library (picrin bootstrap-tools)
(import (scheme base))
(define (list . args) args)
@ -61,6 +60,22 @@
(cons (f (car list))
(map f (cdr list)))))
(define (append xs ys)
(if (null? xs)
ys
(cons (car xs)
(append (cdr xs) ys))))
(export list map append
caar cadr cdar cddr
cadar caddr cdddr))
;;; core syntaces
(define-library (picrin core-syntax)
(import (scheme base)
(picrin macro)
(picrin bootstrap-tools))
(define-syntax let
(er-macro-transformer
(lambda (expr r compare)
@ -110,12 +125,6 @@
(r 'it)
(cons (r 'or) (cdr exprs)))))))))
(define (append xs ys)
(if (null? xs)
ys
(cons (car xs)
(append (cdr xs) ys))))
(define-syntax quasiquote
(er-macro-transformer
(lambda (expr r compare?)
@ -259,7 +268,8 @@
(define-library (picrin multiple-value)
(import (scheme base)
(picrin macro)
(picrin core-syntax))
(picrin core-syntax)
(picrin bootstrap-tools))
(define *values-tag* (cons #f '()))
@ -276,17 +286,6 @@
(apply consumer (cdr res))
(consumer res))))
(define (cadr p) (car (cdr p)))
(define (cddr p) (cdr (cdr p)))
(define (cdar p) (cdr (car p)))
(define (caar p) (car (car p)))
(define (map f list)
(if (null? list)
list
(cons (f (car list))
(map f (cdr list)))))
(define-syntax let*-values
(er-macro-transformer
(lambda (form r c)