, , , seq, , .
:
(let [nums (range)
first-ten (take 10 nums)]
(+ (last first-ten) (nth nums 100000000)))
=> 100000009
2 . ? - , + :
;; Don't do this!
(let [nums (range)
first-ten (take 10 nums)]
(+ (nth nums 100000000) (last first-ten)))
, / , htop , , ( 1G ).
?
, seq clojure . first-ten +. , nth - ( , ), first-ten , , , .
, , (last first-ten), first-ten . nums. nth , , , , , , nth , , , , .
:
;; Don't do this!
(let [nums (range)]
(time (nth nums 1e8))
(time (nth nums 1e8)))
, ? ( ) ( (time (nth nums 1e8))), , nums . nth, , :
(let [nums (range)]
(time (nth nums 1e8))
(time (nth (range) 1e8)))
"Elapsed time: 2127.814253 msecs"
"Elapsed time: 2042.608043 msecs"
, , , , - ( ), .