Cool, thank you.
On Tue, Nov 16, 2021 at 2:15 PM Sage Gerard wrote:
> I get these timings on x86_64 GNU/Linux using the following profile
> program.
>
> ; A: cpu time: 7444 real time: 7445 gc time:
> 716
> ; B: cpu time: 9227 real time: 9228 gc time: 884
>
> (module profile racket/base
> (defi
I get these timings on x86_64 GNU/Linux using the following profile program.
; A: cpu time: 7444 real time: 7445 gc time: 716
; B: cpu time: 9227 real time: 9228 gc time: 884
(module profile racket/base
(define target-length #e5e4)
(define (A current-list new-element)
(append current-list (list
If I want to add an element to the end of an immutable list, is it better
to do:
(append current-list (list new-element))
or
(reverse (cons new-element (reverse current-list)))
or
something else?
I would imagine it's the first one because that should be a single
traversal and link add instead of
3 matches
Mail list logo