nondestructive push
Posted: Wed Nov 09, 2005 10:49 pm
How can I construct a function, that nondestructive appends an element to a list and return modified list?
I wrote so:
But the idea is so usual, that I suspect, there is more fine way, without using
(append lst (list one-element))
... I use 'print-ln' insead of println under windows to handle unix-generated text files.
I wrote so:
Code: Select all
(define (print-ln) (print (join (append (args) (list "\n")))))
(append lst (list one-element))
... I use 'print-ln' insead of println under windows to handle unix-generated text files.