Changeset 34410 in project


Ignore:
Timestamp:
08/27/17 04:42:51 (4 weeks ago)
Author:
kon
Message:

bump ver, re-flow

Location:
release/4/list-utils/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/4/list-utils/trunk/list-utils.scm

    r34121 r34410  
    1414  ensure-list
    1515  not-null?
     16  alist?
    1617  alist-delete-first
    1718  alist-delete-first!
     
    3738  (only data-structures
    3839    rassoc)
    39   (only srfi-1
    40     cons* reverse! append-reverse!)
     40  (only (srfi 1)
     41    cons* reverse! append-reverse!
     42    proper-list? every)
    4143  (only type-checks
    4244    check-list check-alist check-pair check-procedure check-fixnum check-positive-fixnum)
     
    4446    error-alist define-error-type))
    4547(require-library
    46   data-structures srfi-1
     48  data-structures (srfi 1)
    4749  type-checks type-errors)
    4850
     
    7678
    7779(define (section ls n #!optional (step n) (pads '()))
    78   (check-list 'section ls 'ls)
    79   (check-positive-fixnum 'section n 'size)
    80   (check-positive-fixnum 'section step 'step)
    8180  (cond
    8281    ;Do not attempt to section the padding list when
    8382    ;the primary list is empty.
    84     ((null? ls)
     83    ((null? (check-list 'section ls 'ls))
    8584      '() )
    8685    (else
    8786      ;Remaining elements between sections
    88       (let ((inc (fx- step n)))
     87      (let ((inc
     88              (fx-
     89                (check-positive-fixnum 'section step 'step)
     90                (check-positive-fixnum 'section n 'size))))
    8991        (let loop ((ls ls) (parts '()))
    9092          ;Get this section
     
    9597                ;Possible empty section when no padding.
    9698                ;otherwise complete with this, the last, section
    97                 (if (null? part)
    98                   (reverse! parts)
    99                   (reverse! (cons part parts)) ) )
     99                (reverse! (if (null? part) parts (cons part parts))) )
    100100              (else
    101101                ;Skip over "between" elements and continue sectioning the list.
    102                 (let (
    103                     (ls
    104                       (cond
    105                         ;step = n
    106                         ((fx= 0 inc)
    107                           nls )
    108                         ;step < n so skip from starting this section element
    109                         ((fx> 0 inc)
    110                           (*skip+ ls (+ n inc)) )
    111                         ;step > n so skip remaining elements in between
    112                         (else
    113                           (*skip+ nls inc) ) ) ) )
     102                (let ((ls
     103                        (cond
     104                          ;step = n
     105                          ((fx= 0 inc)
     106                            nls )
     107                          ;step < n so skip from starting this section element
     108                          ((fx> 0 inc)
     109                            (*skip+ ls (+ n inc)) )
     110                          ;step > n so skip remaining elements in between
     111                          (else
     112                            (*skip+ nls inc) ) ) ) )
    114113                  (loop ls (cons part parts)) ) ) ) ) ) ) ) ) )
    115114
     
    265264          (error-alist 'alist->plist als)
    266265          (loop (cdr als) (cons* (cdr elt) (car elt) pls)) ) ) ) ) )
     266
     267;;
     268
     269(define (alist? obj)
     270  (and
     271    (proper-list? obj)
     272    (every pair? obj) ) )
    267273
    268274;; Search the alist from back to front.
     
    324330              (cond
    325331                ((cmp key (car elt))
    326                   (if pal (set-cdr! pal nxt)
     332                  (if pal
     333                    (set-cdr! pal nxt)
    327334                    (set! ral nxt) )
    328335                  (loop nxt pal (fx- cnt 1)) )
  • release/4/list-utils/trunk/list-utils.setup

    r34121 r34410  
    55(verify-extension-name "list-utils")
    66
    7 (setup-shared-extension-module 'list-utils (extension-version "1.1.2")
     7(setup-shared-extension-module 'list-utils (extension-version "1.1.3")
    88  #:inline? #t
    99  #:types? #t
Note: See TracChangeset for help on using the changeset viewer.