Changeset 15951 in project for chicken


Ignore:
Timestamp:
09/19/09 00:30:07 (10 years ago)
Author:
kon
Message:

Unit srfi-69 is-a core-library-module but not a builtin-feature, and Unit regex-extras doesn't exist.
Added %list-fold, alist routines, renamed any/1. (chicken-primitive-object-inlines.scm).

Location:
chicken/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • chicken/trunk/chicken-primitive-object-inlines.scm

    r14188 r15951  
    712712        (loop (%cdr ls) (%fxsub1 n)) ) ) )
    713713
    714 (define-inline (%any/1 pred? ls)
     714(define-inline (%list-any/1 pred? ls)
    715715  (let loop ((ls ls))
    716716    (and (not (%null? ls))
     
    718718             (loop (%cdr ls)) ) ) ) )
    719719
     720(define-inline (%list-every/1 pred? ls)
     721  (let loop ((ls ls) (last #t))
     722    (if (%null? ls) last
     723        (let ((this (pred? (%car ls))))
     724          (and this
     725               (loop (%cdr ls) this)) ) ) ) )
     726
    720727(define-inline (%list-length ls0)
    721728  (let loop ((ls ls0) (n 0))
    722729    (if (%null? ls) n
    723730        (loop (%cdr ls) (%fxadd1 n)) ) ) )
     731
     732(define-inline (%list-find pred? ls)
     733  (let loop ((ls ls))
     734    (and (not (%null? ls))
     735         (or (let ((elm (%car ls))) (and (pred? elm) elm))
     736             (loop (%cdr ls)) ) ) ) )
     737
     738(define-inline (%alist-ref key al #!optional (test eqv?) def)
     739  (let loop ((al al))
     740    (cond ((%null? al) def )
     741          ((test key (%caar al)) (%cdar al) )
     742          (else (loop (%cdr al)) ) ) ) )
     743
     744(define-inline (%alist-update! key val al0 #!optional (test eqv?))
     745  (let loop ((al al0))
     746    (cond ((%null? al) (%cons (%cons key val) al0) )
     747          ((test key (%caar al)) (%set-cdr! (%car al) val) al0 )
     748          (else (loop (%cdr al)) ) ) ) )
     749
     750(define-inline (%alist-delete! key al0 #!optional (test equal?))
     751  (let loop ((al al0) (prv #f))
     752    (cond ((%null? al) al0)
     753          ((test key (%caar al)) (if prv (begin (%set-cdr! prv (%cdr al)) al0) (%cdr al)) )
     754          (else (loop (%cdr al) al) ) ) ) )
    724755
    725756;; Structure (wordblock)
  • chicken/trunk/eval.scm

    r15918 r15951  
    105105
    106106(define ##sys#core-library-modules
    107   '(extras lolevel utils files tcp regex regex-extras posix srfi-1 srfi-4 srfi-13
    108            srfi-14 srfi-18 data-structures ports chicken-syntax))
     107  '(extras lolevel utils files tcp regex posix srfi-1 srfi-4 srfi-13
     108           srfi-14 srfi-18 srfi-69 data-structures ports chicken-syntax))
    109109
    110110(define ##sys#explicit-library-modules '())
     
    128128(define-constant builtin-features
    129129  '(chicken srfi-2 srfi-6 srfi-10 srfi-12 srfi-23 srfi-28 srfi-30 srfi-31 srfi-39
    130             srfi-69 srfi-88 srfi-98) )
     130            srfi-88 srfi-98) )
    131131
    132132(define-constant builtin-features/compiled
Note: See TracChangeset for help on using the changeset viewer.