mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-14 08:17:35 +02:00
Issue #417 - Experimental SRFI alias functionality
Proof of concept to allow aliases for SRFI's. This needs to be cleaned up and built-out to perform appropriate aliasing for all SRFI's.
This commit is contained in:
parent
8143614c34
commit
a3ea98f90c
1 changed files with 18 additions and 1 deletions
|
@ -78,6 +78,19 @@
|
||||||
)
|
)
|
||||||
(begin
|
(begin
|
||||||
|
|
||||||
|
;; Experimental alias functionality
|
||||||
|
(define *aliases*
|
||||||
|
`( ((scheme list) . (srfi ,(string->symbol "1")))
|
||||||
|
((scheme hash-table) . (srfi ,(string->symbol "69")))
|
||||||
|
))
|
||||||
|
|
||||||
|
(define (lib:import-from-alias import)
|
||||||
|
(let ((conv (assoc import *aliases*)))
|
||||||
|
(if conv
|
||||||
|
(cdr conv)
|
||||||
|
import)))
|
||||||
|
;; END aliases
|
||||||
|
|
||||||
(define (library? ast)
|
(define (library? ast)
|
||||||
(tagged-list? 'define-library ast))
|
(tagged-list? 'define-library ast))
|
||||||
|
|
||||||
|
@ -92,11 +105,15 @@
|
||||||
;; (srfi 18) containing the number 18. An import set contains only symbols
|
;; (srfi 18) containing the number 18. An import set contains only symbols
|
||||||
;; or sub-lists.
|
;; or sub-lists.
|
||||||
(define (lib:list->import-set lis)
|
(define (lib:list->import-set lis)
|
||||||
|
(lib:import-from-alias
|
||||||
|
(%lib:list->import-set lis)))
|
||||||
|
|
||||||
|
(define (%lib:list->import-set lis)
|
||||||
(map
|
(map
|
||||||
(lambda (atom)
|
(lambda (atom)
|
||||||
(cond
|
(cond
|
||||||
((pair? atom)
|
((pair? atom)
|
||||||
(lib:list->import-set atom))
|
(%lib:list->import-set atom))
|
||||||
((number? atom)
|
((number? atom)
|
||||||
(string->symbol (number->string atom)))
|
(string->symbol (number->string atom)))
|
||||||
(else atom)))
|
(else atom)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue