Page 1 of 1

'save' with write/append flag?

Posted: Fri Feb 04, 2005 10:25 am
by HPW
Would it make sense to add a write/append flag to the save-command?

(save "MyNewFile" "w" 'sym1 'sym2 ....)

(save "MyExistFile" "a" 'sym1 'sym2 ....)

Of cource would break existing code. :-(

Or is it better to do:

(device(open "MyNewFile" "w"))
(print(source 'sym1 'sym2 ....))
(close (device))

(device(open "MyExistFile" "a"))
(print(source 'sym1 'sym2 ....))
(close (device))

(I used my previous wish here for source with multiple arguments, a loop can do it also) ;-)

Posted: Fri Feb 04, 2005 10:41 am
by HPW
As mostly the answer is not far away in lisp:

Code: Select all

(device(open "MyNewFile" "w"))
(setq mycontent(map source(list 'sym1 'sym2 .... )))
(dolist (symstr mycontent)(print symstr))
(close (device))