mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-24 04:25:06 +02:00
Cache symbols instead of computing them each time
This commit is contained in:
parent
516c13c6df
commit
821e04eb34
1 changed files with 8 additions and 4 deletions
|
@ -22,6 +22,10 @@
|
||||||
Cyc-opaque-unsafe-string->number)
|
Cyc-opaque-unsafe-string->number)
|
||||||
(begin
|
(begin
|
||||||
|
|
||||||
|
(define *sym-dot* (string->symbol "."))
|
||||||
|
(define *sym-unquote-splicing* (string->symbol ",@"))
|
||||||
|
(define *sym-datum-comment* (string->symbol "#;"))
|
||||||
|
|
||||||
(define-syntax include
|
(define-syntax include
|
||||||
(er-macro-transformer
|
(er-macro-transformer
|
||||||
(lambda (expr rename compare)
|
(lambda (expr rename compare)
|
||||||
|
@ -46,7 +50,7 @@
|
||||||
(define (->dotted-list lst)
|
(define (->dotted-list lst)
|
||||||
(cond
|
(cond
|
||||||
((null? lst) '())
|
((null? lst) '())
|
||||||
((equal? (car lst) (string->symbol "."))
|
((equal? (car lst) *sym-dot*)
|
||||||
(cadr lst))
|
(cadr lst))
|
||||||
(else
|
(else
|
||||||
(cons (car lst) (->dotted-list (cdr lst))))))
|
(cons (car lst) (->dotted-list (cdr lst))))))
|
||||||
|
@ -141,7 +145,7 @@
|
||||||
(read-error fp "missing closing parenthesis"))
|
(read-error fp "missing closing parenthesis"))
|
||||||
((Cyc-opaque-eq? t #\))
|
((Cyc-opaque-eq? t #\))
|
||||||
(if (and (> (length lis) 2)
|
(if (and (> (length lis) 2)
|
||||||
(equal? (cadr lis) (string->symbol ".")))
|
(equal? (cadr lis) *sym-dot*))
|
||||||
(->dotted-list (reverse lis))
|
(->dotted-list (reverse lis))
|
||||||
(reverse lis)))
|
(reverse lis)))
|
||||||
(else
|
(else
|
||||||
|
@ -182,9 +186,9 @@
|
||||||
(apply bytevector (reverse lis)))
|
(apply bytevector (reverse lis)))
|
||||||
(else
|
(else
|
||||||
(loop (cons t lis) (parse fp))))))
|
(loop (cons t lis) (parse fp))))))
|
||||||
((eq? token (string->symbol ",@"))
|
((eq? token *sym-unquote-splicing*)
|
||||||
(list 'unquote-splicing (parse fp)))
|
(list 'unquote-splicing (parse fp)))
|
||||||
((eq? token (string->symbol "#;"))
|
((eq? token *sym-datum-comment*)
|
||||||
(parse fp) ;; Ignore next datum
|
(parse fp) ;; Ignore next datum
|
||||||
(parse fp))
|
(parse fp))
|
||||||
;; Other special cases?
|
;; Other special cases?
|
||||||
|
|
Loading…
Add table
Reference in a new issue