Adding conf-get-cdr.

This commit is contained in:
Alex Shinn 2013-12-19 23:34:24 +09:00
parent 4993769e65
commit b0b2a5c5d2
2 changed files with 12 additions and 2 deletions

View file

@ -241,7 +241,17 @@
(if (or (pair? res) (null? res)) res (list res)) (if (or (pair? res) (null? res)) res (list res))
(if (pair? opt) (car opt) '())))) (if (pair? opt) (car opt) '()))))
;;> Equivalent to \scheme{conf-get} but always returns the
;;> \scheme{cdr} as-is without possibly taking its \scheme{car}.
(define (conf-get-cdr config key . opt)
(let ((cell (conf-get-cell config key)))
(if (not cell)
(and (pair? opt) (car opt))
(cdr cell))))
;;> Equivalent to \scheme{conf-get-list} but returns a list of all ;;> Equivalent to \scheme{conf-get-list} but returns a list of all
;;> cascaded configs appended together.
(define (conf-get-multi config key) (define (conf-get-multi config key)
(if (not config) (if (not config)

View file

@ -2,8 +2,8 @@
(define-library (chibi config) (define-library (chibi config)
(export make-conf conf? conf-load conf-load-in-path conf-load-cascaded (export make-conf conf? conf-load conf-load-in-path conf-load-cascaded
conf-verify conf-extend conf-append conf-set conf-unfold-key conf-verify conf-extend conf-append conf-set conf-unfold-key
conf-get conf-get-list conf-get-multi conf-get conf-get-list conf-get-cdr conf-get-multi
conf-specialize read-from-file conf-source) conf-specialize read-from-file conf-source conf-head conf-parent)
(import (scheme base) (scheme read) (scheme write) (scheme file) (import (scheme base) (scheme read) (scheme write) (scheme file)
(scheme time) (srfi 1)) (scheme time) (srfi 1))
;; This is only used for config verification, it's acceptable to ;; This is only used for config verification, it's acceptable to