Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Create ranged list scheme

Name: Anonymous 2012-02-11 14:04

Does anyone have a faster technique to build a list between a start and stop value? 
I made the straight forward

[code]

(define (mkrng min max)
  (cond
   ((< max min) '())
   (else(cons max (mkrng min (- max 1)))))) [\code]
 
But it is really slow for my application which needs lists of tens of millions of numbers

Name: Anonymous 2012-02-11 14:28

(define (mkrng min max)
  (let loop ((i min)
             (acc '()))
    (if (> i max)
        acc
        (loop (+ i 1) (cons i acc)))))

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List