mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Experimenting with faster versions of map, for-each
This commit is contained in:
parent
6d9c55eb0d
commit
48845ce23b
1 changed files with 13 additions and 0 deletions
|
@ -83,6 +83,8 @@
|
|||
make-list
|
||||
list-copy
|
||||
map
|
||||
Cyc-map-loop-1
|
||||
Cyc-for-each-loop-1
|
||||
for-each
|
||||
list-tail
|
||||
list-ref
|
||||
|
@ -786,6 +788,17 @@
|
|||
;; Fast path.
|
||||
(foldr (lambda (x y) (cons (f x) y)) '() lis1)))
|
||||
|
||||
;; Experimenting with faster versions of map, for-each
|
||||
(define (Cyc-map-loop-1 f lst)
|
||||
(if (null? lst)
|
||||
'()
|
||||
(cons (f (car lst)) (Cyc-map-loop-1 f (cdr lst)))))
|
||||
(define (Cyc-for-each-loop-1 f lst)
|
||||
(if (null? lst)
|
||||
'()
|
||||
(begin (f (car lst))
|
||||
(Cyc-for-each-loop-1 f (cdr lst)))))
|
||||
|
||||
(define (for-each f lis1 . lists)
|
||||
(if (not (null? lis1))
|
||||
(if (pair? lists)
|
||||
|
|
Loading…
Add table
Reference in a new issue