You are doing it right, and you see that on a bigger data object reference passing is much faster.
But speed is not the only reason you would do reference passing. The second reason is, that with reference passing you can make 'my-process' a
destructive function changing the original contents:
Code: Select all
(set 'long-text (parse "this is a sentence") )
(define C:C long-text)
(define D long-text)
(define (my-process lst)
(nth-set (lst 0) "word "))
(my-process C)
C:C => ("word " "is" "a" "sentence")
(my-process D)
D = ("this" "is" "a" "sentence")
C:C has changed but D did not.