Changeset 14030 in project


Ignore:
Timestamp:
04/01/09 05:51:41 (11 years ago)
Author:
Kon Lovett
Message:

Update inlines.

Location:
release/4/stack
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • release/4/stack/tags/2.0.0/chicken-primitive-object-inlines.scm

    r14015 r14030  
    671671                 (find-elm (%cdr ls) ls) ) ) ) )
    672672
    673 (define-inline (%list-fold-1 func init ls0)
     673(define-inline (%list-fold/1 func init ls0)
    674674  ;(assert (and (proper-list? ls0) (procedure? func)))
    675675  (let loop ((ls ls0) (acc init))
     
    677677        (loop (%cdr ls) (func (%car ls) acc)) ) ) )
    678678
    679 (define-inline (%list-map-1 func ls0)
     679(define-inline (%list-map/1 func ls0)
    680680  ;(assert (and (proper-list? ls0) (procedure? func)))
    681681  (let loop ((ls ls0))
     
    683683        (%cons (func (%car ls)) (loop (%cdr ls))) ) ) )
    684684
    685 (define-inline (%list-for-each-1 proc ls0)
     685(define-inline (%list-for-each/1 proc ls0)
    686686  ;(assert (and (proper-list? ls0) (procedure? proc)))
    687687  (let loop ((ls ls0))
     
    689689      (proc (%car ls))
    690690      (loop (%cdr ls)) ) ) )
     691
     692(define-inline (%make-list n e)
     693  (let loop ((n n) (ls '()))
     694    (if (%fxzero? n) ls
     695        (loop (%fxsub1 n) (%cons e ls)) ) ) )
     696
     697(define-inline (%list-take ls0 n)
     698  (let loop ((ls ls0) (n n))
     699    (if (%fxzero? n) '()
     700        (%cons (%car ls) (loop (%cdr ls) (%fxsub1 n))) ) ) )
     701
     702(define-inline (%list-drop ls0 n)
     703  (let loop ((ls ls0) (n n))
     704    (if (%fxzero? n) ls
     705        (loop (%cdr ls) (%fxsub1 n)) ) ) )
    691706
    692707;; Structure (wordblock)
  • release/4/stack/tags/2.0.0/stack.scm

    r13722 r14030  
    6969                (%car ls) ) )
    7070
    71 (define-inline (%stack-push-1! stk obj)
     71(define-inline (%stack-push/1! stk obj)
    7272  (%stack-count-inc! stk 1)
    7373        (%stack-list-set! stk (%cons obj (%stack-list stk))) )
    7474
    7575(define-inline (%stack-push! stk ls)
    76   (if (%null? (%cdr ls)) (%stack-push-1! stk (%car ls))
    77             (%list-for-each-1 (lambda (x) (%stack-push-1! stk x)) ls) ) )
     76  (if (%null? (%cdr ls)) (%stack-push/1! stk (%car ls))
     77            (%list-for-each/1 (lambda (x) (%stack-push/1! stk x)) ls) ) )
    7878
    7979(define-inline (%stack-node-ref loc stk idx)
     
    220220(define (stack-fold stk func init)
    221221  (%check-stack 'stack-fold stk)
    222         (%list-fold-1 func init (%stack-list stk)) )
     222        (%list-fold/1 func init (%stack-list stk)) )
    223223
    224224(define (stack-map stk func)
    225225  (%check-stack 'stack-map stk)
    226         (%list-map-1 func (%stack-list stk)) )
     226        (%list-map/1 func (%stack-list stk)) )
    227227
    228228(define (stack-for-each stk proc)
    229229  (%check-stack 'stack-for-each stk)
    230         (%list-for-each-1 proc (%stack-list stk)) )
     230        (%list-for-each/1 proc (%stack-list stk)) )
    231231
    232232;;; Read/Print Syntax
  • release/4/stack/trunk/chicken-primitive-object-inlines.scm

    r14015 r14030  
    671671                 (find-elm (%cdr ls) ls) ) ) ) )
    672672
    673 (define-inline (%list-fold-1 func init ls0)
     673(define-inline (%list-fold/1 func init ls0)
    674674  ;(assert (and (proper-list? ls0) (procedure? func)))
    675675  (let loop ((ls ls0) (acc init))
     
    677677        (loop (%cdr ls) (func (%car ls) acc)) ) ) )
    678678
    679 (define-inline (%list-map-1 func ls0)
     679(define-inline (%list-map/1 func ls0)
    680680  ;(assert (and (proper-list? ls0) (procedure? func)))
    681681  (let loop ((ls ls0))
     
    683683        (%cons (func (%car ls)) (loop (%cdr ls))) ) ) )
    684684
    685 (define-inline (%list-for-each-1 proc ls0)
     685(define-inline (%list-for-each/1 proc ls0)
    686686  ;(assert (and (proper-list? ls0) (procedure? proc)))
    687687  (let loop ((ls ls0))
     
    689689      (proc (%car ls))
    690690      (loop (%cdr ls)) ) ) )
     691
     692(define-inline (%make-list n e)
     693  (let loop ((n n) (ls '()))
     694    (if (%fxzero? n) ls
     695        (loop (%fxsub1 n) (%cons e ls)) ) ) )
     696
     697(define-inline (%list-take ls0 n)
     698  (let loop ((ls ls0) (n n))
     699    (if (%fxzero? n) '()
     700        (%cons (%car ls) (loop (%cdr ls) (%fxsub1 n))) ) ) )
     701
     702(define-inline (%list-drop ls0 n)
     703  (let loop ((ls ls0) (n n))
     704    (if (%fxzero? n) ls
     705        (loop (%cdr ls) (%fxsub1 n)) ) ) )
    691706
    692707;; Structure (wordblock)
  • release/4/stack/trunk/stack.scm

    r13722 r14030  
    6969                (%car ls) ) )
    7070
    71 (define-inline (%stack-push-1! stk obj)
     71(define-inline (%stack-push/1! stk obj)
    7272  (%stack-count-inc! stk 1)
    7373        (%stack-list-set! stk (%cons obj (%stack-list stk))) )
    7474
    7575(define-inline (%stack-push! stk ls)
    76   (if (%null? (%cdr ls)) (%stack-push-1! stk (%car ls))
    77             (%list-for-each-1 (lambda (x) (%stack-push-1! stk x)) ls) ) )
     76  (if (%null? (%cdr ls)) (%stack-push/1! stk (%car ls))
     77            (%list-for-each/1 (lambda (x) (%stack-push/1! stk x)) ls) ) )
    7878
    7979(define-inline (%stack-node-ref loc stk idx)
     
    220220(define (stack-fold stk func init)
    221221  (%check-stack 'stack-fold stk)
    222         (%list-fold-1 func init (%stack-list stk)) )
     222        (%list-fold/1 func init (%stack-list stk)) )
    223223
    224224(define (stack-map stk func)
    225225  (%check-stack 'stack-map stk)
    226         (%list-map-1 func (%stack-list stk)) )
     226        (%list-map/1 func (%stack-list stk)) )
    227227
    228228(define (stack-for-each stk proc)
    229229  (%check-stack 'stack-for-each stk)
    230         (%list-for-each-1 proc (%stack-list stk)) )
     230        (%list-for-each/1 proc (%stack-list stk)) )
    231231
    232232;;; Read/Print Syntax
Note: See TracChangeset for help on using the changeset viewer.