'save' with write/append flag?

Q&A's, tips, howto's
Locked
HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

'save' with write/append flag?

Post 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) ;-)
Hans-Peter

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post 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))
Hans-Peter

Locked