summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar John Cowan 2020-09-11 17:56:46 -0400
committerGravatar John Cowan 2020-09-11 17:56:46 -0400
commit923051aad63cb99c142c476932aaa875c004216f (patch)
tree52553ef53679fdb354d576d6913394699b30cf38
parentnext stage of Dictionaries; added right-fold to FoldOrder (diff)
added Dictionaries externals
Diffstat (limited to '')
-rw-r--r--externals.scm122
1 files changed, 122 insertions, 0 deletions
diff --git a/externals.scm b/externals.scm
new file mode 100644
index 0000000..1a7f0e3
--- /dev/null
+++ b/externals.scm
@@ -0,0 +1,122 @@
+;;; External (exported) procedure definitions
+
+(define-syntax dispatch
+ (syntax-rules ()
+ (dispatch index dictionary args ...)
+ (let ((vec (lookup dictionary #t)) ; error if not found
+ ((vector-ref vec index) vec dictionary args ...))))))
+
+(define-syntax proc-dispatch
+ (syntax-rules ()
+ (dispatch index dictionary args ...)
+ (let ((vec (lookup dictionary #t)) ; error if not found
+ ((vector-ref vec index) vec args ...))))))
+
+(define (dictionary? obj)
+ (if (lookup obj #f) #t #f)) ; #f if not found
+
+(define (dict-empty? dictionary)
+ (dispatch dempty dictionary))
+
+(define (dict-contains? dictionary key)
+ (dispatch dcontains? dictionary key))
+
+(define dict-ref
+ (case-lambda
+ ((vec dictionary key)
+ (dict-ref vec dictionary key error values))
+ ((vec dictionary key failure)
+ (dict-ref vec dictionary key failure values))
+ ((vec dictionary key failure success))
+ (dict-ref* vec dictionary key failure success)))))
+
+
+(define (dict-ref* dictionary key failure success)
+ (dispatch dref dictionary key failure success))
+(define (dict-ref/default dictionary key default)
+ (dispatch dref/default dictionary key default))
+
+(define (dict-set! dictionary . objs)
+ (dispatch dset! dictionary objs))
+
+(define (dict-adjoin! dictionary . objs)
+ (dispatch dadjoin! dictionary objs))
+
+(define (dict-delete! dictionary . keys)
+ (dispatch ddelete! dictionary keys))
+
+(define (dict-delete-all! dictionary keylist)
+ (dispatch ddelete-all dictionary keylist))
+
+(define (dict-replace! dictionary key value)
+ (dispatch dreplace! dictionary key value))
+
+(define (dict-intern! dictionary key failure)
+ (dispatch dintern! dictionary key failure))
+
+(define dict-update!
+ (case-lambda)
+ ((vec dictionary key updater))
+ (dict-update! vec dictionary key updater error values)))
+ ((vec dictionary key updater failure))
+ (dict-update! vec dictionary key updater failure values)))
+ ((vec dictionary key updater failure success))
+ (dispatch dupdate! dictionary key updater failure success))
+
+(define (dict-update/default! dictionary key updater default)
+ (dispatch dupdate/default dictionary key updater default))
+
+(define dict-pop!
+ (case-lambda)
+ ((vec dictionary))
+ (dict-pop!* vec dictionary error)))
+ ((vec dictionary failure))
+ (dict-pop!* vec dictionary failure)))))
+
+(define (dict-pop!* vec dictionary failure)
+ (dispatch dpop! dictionary failure))
+
+(define (dict-map! proc dictionary)
+ (proc-dispatch dmap! dictionary proc dictionary))
+
+(define (dict-filter! pred dictionary)
+ (proc-dispatch dfilter! dictionary pred dictionary))
+
+(define (dict-remove! pred dictionary)
+ (dispatch dremove! dictionary yyy))
+
+(define (dict-search! dictionary key failure success)
+ (dispatch dsearch! dictionary yyy)
+
+(define (dict-size dictionary)
+ (dispatch dsize dictionary yyy)
+
+(define (dict-for-each proc dictionary)
+ (proc-dispatch dfor-each dictionary proc dictionary)
+
+(define (dict-count pred dictionary)
+ (dispatch dcount dictionary yyy))
+
+(define (dict-any pred dictionary)
+ (dispatch dany dictionary yyy))
+
+(define (dict-every pred dictionary)
+ (dispatch devery dictionary yyy))
+
+(define (dict-keys dictionary)
+ (dispatch dkeys dictionary yyy))
+
+(define (dict-values dictionary)
+ (dispatch dvalues dictionary yyy))
+
+(define (dict-entries dictionary)
+ (dispatch dentries dictionary yyy))
+
+(define (dict-fold proc knil dictionary)
+ (proc-dispatch dfold dictionary proc knil dictionary))
+
+(define (dict-map->list proc dictionary)
+ (proc-dispatch dmap->list dictionary proc dictionary))
+
+(define (dict->alist dictionary)
+ (dispatch d->alist dictionary yyy))
t/debian/rules?h=v2.0.6&id=0966e80dce18c948225fe6b739c879809bc07b78&follow=1'>Add ldconfig in deb postinst for Debian policy conformance.Gravatar aeb 2-2/+17 2000-11-23Removed acconfig.h, which wasn't needed for some time.Gravatar aeb 1-13/+0 2000-11-22Added ieee1394.h header.Gravatar aeb 3-1/+38 2000-09-13Fix raw1394_start_iso_write() which uses wrong variable.Gravatar aeb 1-1/+1 2000-09-10Work around compiler warnings for int/ptr casts.Gravatar aeb 6-10/+20 2000-09-10Added control files for Debian packages.Gravatar aeb 6-8/+106 2000-09-01Added missing prototypes for iso send functions.Gravatar aeb 1-0/+7 2000-08-08Added raw1394_get_irm_id().Gravatar aeb 7-7/+39 2000-08-06Added support for isochronous sending.Gravatar aeb 3-0/+35 2000-07-05Added raw1394_reset_bus() call.Gravatar aeb 4-0/+23 2000-06-22- Set library version info in configure.in, use in src/Makefile.am.Gravatar aeb 4-2/+16 2000-06-15Update libtool version number.Gravatar aeb 2-2/+2 2000-06-14Added copyright headers.Gravatar aeb 6-0/+54 2000-06-11Added explicit AC_PROG_INSTALL call.Gravatar aeb 1-0/+1 2000-06-09Fix size of error field.Gravatar aeb 1-2/+2 2000-06-02Modified support for 32/64 bit environments, control struct fields have fixed...Gravatar aeb 7-43/+28 2000-05-28Added support for environments with 64 bit kernel and 32 bit userland.Gravatar aeb 8-7/+45 2000-04-27Fixed missing setting of ext code in raw1394_start_lock()Gravatar aeb 1-0/+1 2000-04-15Fixed lock transaction to actually return response value.Gravatar aeb 3-5/+11 2000-04-12Add userdata functions as news.Gravatar aeb 1-0/+4 2000-04-05Add userdata functions.Gravatar aeb 3-0/+18 2000-03-18Bump version number to 0.6.Gravatar aeb 3-5/+6 2000-03-18Mention byte order change.Gravatar aeb 1-0/+2 2000-03-18Mention SourceForge home.Gravatar aeb 1-1/+5