|
From: | Aaron Hill |
Subject: | Re: scheme set list function |
Date: | Sat, 06 Apr 2019 10:09:05 -0700 |
User-agent: | Roundcube Webmail/1.3.8 |
On 2019-04-06 9:50 am, Thomas Morley wrote:
Though, I'd think you should rethink whatever you plan, I'm very skeptic about always resetting a toplevel defined list. It's too destructive.
Also, it is convention to use an exclamation point as a suffix when naming procedures that may modify the structure of arguments to produce their results. This makes it easier for users to know where side effects might exist.
Consider this: %%%%#(define (1+last! lst) (list-set! lst (- (length lst) 1) (1+ (last lst))))
#(define foo '(1 2 3)) #(1+last! foo) #(format #t "\nfoo = ~a" foo) #(1+last! foo) #(format #t "\nfoo = ~a" foo) %%%% -- Aaron Hill
[Prev in Thread] | Current Thread | [Next in Thread] |