mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 21:59:17 +02:00
They can be close()d explicitly with close-file-descriptor, and will close() on gc, but only explicitly closing the last port on them will close the fileno. Notably needed for network sockets where we open separate input and output ports on the same socket.
14 lines
453 B
Scheme
14 lines
453 B
Scheme
;; alist.scm -- association list utilities
|
|
;; Copyright (c) 2009 Alex Shinn. All rights reserved.
|
|
;; BSD-style license: http://synthcode.com/license.txt
|
|
|
|
(define (alist-cons key value ls) (cons (cons key value) ls))
|
|
|
|
(define (alist-copy ls) (map (lambda (x) (cons (car x) (cdr x))) ls))
|
|
|
|
(define (alist-delete key ls . o)
|
|
(let ((eq (if (pair? o) (car o) equal?)))
|
|
(remove (lambda (x) (eq (car x) key)) ls)))
|
|
|
|
(define alist-delete! alist-delete)
|
|
|