From fcefb339832ab5d4815030f7536696c562659d79 Mon Sep 17 00:00:00 2001 From: frese Date: Wed, 11 Jul 2001 14:12:22 +0000 Subject: [PATCH] renamed to helper.scm --- scheme/xlib/stuff.scm | 42 ------------------------------------------ 1 file changed, 42 deletions(-) delete mode 100644 scheme/xlib/stuff.scm diff --git a/scheme/xlib/stuff.scm b/scheme/xlib/stuff.scm deleted file mode 100644 index 8867270..0000000 --- a/scheme/xlib/stuff.scm +++ /dev/null @@ -1,42 +0,0 @@ -;; named-args->alist does this: -;; '(a 5 b 6 ((c . 10) (d . 5))) -> '((a . 5) (b . 6) (c . 10) (d . 5)) -;; '(e 3) -> '((e . 3)) -;; '((f . 0)) -> '((f . 0)) -;; (hard to explain :-) - -(define (named-args->alist args) - (let loop ((alist '()) - (args args)) - (cond - ((null? args) (reverse alist)) - ((null? (cdr args)) (loop (append (car args) alist) '())) - (else (let ((sym (car args)) - (val (cadr args))) - (loop (cons (cons sym val) alist) - (cddr args))))))) - - -(define-exported-binding "string->symbol" string->symbol) - - -;; alist-split returns multiple values. the first values are all associations -;; of the keys. and additionaly the "rest" of the alist as one value. - -(define (alist-split alist key-def-list) - (let ((keys (map car key-def-list))) - (let ((vals (map (lambda (key) - (let ((v (assq key alist))) - (if v v (assq key key-def-list)))) - keys)) - (rest (fold-right (lambda (this rest) - (if (memq (car this) keys) - rest - (cons this rest))) - '() - alist))) - (apply values (append vals (list rest)))))) - -;; according to the XLib constant "Null" which is defined as "0L" - -(define null-resource? zero?) -(define null-resource 0) \ No newline at end of file