lmdb

Check-in [d177d483aa]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Simplified and corrected database->alist
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d177d483aa92fade3dcd1ecc2cb0c158891e547028d7b94cfdd1ee22f55b1e6f
User & Date: murphy 2018-08-20 22:04:08
Context
2018-08-20
22:04
Initial test suite check-in: f971d52bba user: murphy tags: trunk
22:04
Simplified and corrected database->alist check-in: d177d483aa user: murphy tags: trunk
21:13
Initial documentation check-in: 79aad68b11 user: murphy tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to lmdb.scm.

551
552
553
554
555
556
557
558





559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
(define (database-walk proc dbi . args)
  (apply
   database-fold
   (lambda (key val seed) (proc key val) seed) (void)
   dbi args))

(define (database->alist dbi #!rest args #!key from to< to<=)
  (reverse!





   (database-fold
    (if (memq #:duplicate-list args)
        (lambda (key val rest)
          (if (pair? rest)
              (if (equal? key (caar rest))
                  (begin
                    (set-cdr! (car rest) (cons val (cdar rest)))
                    rest)
                  (begin
                    (set-cdr! (car rest) (reverse! (cdar rest)))
                    (cons (cons key (list val)) rest)))
              (cons (cons key (list val)) rest)))
        (lambda (key val rest)
          (cons (cons key val) rest)))
    '() dbi #:from from #:to< to< #:to<= to<=)))

(define (alist->database alist . args)
  (let-keys+flags open-database args







|
>
>
>
>
>



<
|
|
|
|
<
<
<







551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566

567
568
569
570



571
572
573
574
575
576
577
(define (database-walk proc dbi . args)
  (apply
   database-fold
   (lambda (key val seed) (proc key val) seed) (void)
   dbi args))

(define (database->alist dbi #!rest args #!key from to< to<=)
  (fold
   (lambda (key+val rest)
     (let ([val (cdr key+val)])
       (when (pair? val) (set-cdr! key+val (reverse! val))))
     (cons key+val rest))
   '()
   (database-fold
    (if (memq #:duplicate-list args)
        (lambda (key val rest)

          (if (and (pair? rest) (equal? key (caar rest)))
              (begin
                (set-cdr! (car rest) (cons val (cdar rest)))
                rest)



              (cons (cons key (list val)) rest)))
        (lambda (key val rest)
          (cons (cons key val) rest)))
    '() dbi #:from from #:to< to< #:to<= to<=)))

(define (alist->database alist . args)
  (let-keys+flags open-database args